Skip to content

Commit ae44a7c

Browse files
Merge pull request #2 from helmhub-io/ft/image-migration
docker images migration script
2 parents 6aefae1 + 9a55c8d commit ae44a7c

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Migrate BitnamiLegacy Images to HelmHubIO
2+
3+
on:
4+
workflow_dispatch: # run manually from GitHub Actions tab
5+
6+
jobs:
7+
migrate:
8+
name: Migrate Docker Images
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
# --------------------------------------------------------------
13+
# 🧰 Step 1: Checkout your repository (where the script is stored)
14+
# --------------------------------------------------------------
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
# --------------------------------------------------------------
19+
# 🧩 Step 2: Install dependencies
20+
# --------------------------------------------------------------
21+
- name: Install dependencies
22+
run: |
23+
sudo apt-get update -y
24+
sudo apt-get install -y jq curl
25+
26+
# --------------------------------------------------------------
27+
# 🔑 Step 3: Log in to Docker Hub
28+
# --------------------------------------------------------------
29+
- name: Docker Login
30+
env:
31+
DOCKER_USER: ${{ secrets.DOCKER_USER }}
32+
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
33+
run: |
34+
echo "🔐 Logging into Docker Hub..."
35+
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin
36+
37+
# --------------------------------------------------------------
38+
# 🚀 Step 4: Run migration script
39+
# --------------------------------------------------------------
40+
- name: Run DockerHub migration
41+
env:
42+
DOCKER_USER: ${{ secrets.DOCKER_USER }}
43+
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
44+
run: |
45+
chmod +x ./migrate-images.sh
46+
./migrate-images.sh
47+
48+
# --------------------------------------------------------------
49+
# ✅ Step 5: Summary
50+
# --------------------------------------------------------------
51+
- name: Complete
52+
run: echo "🎉 Migration completed successfully!"

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,32 @@
66
This code repository (or "repo") is designed to demonstrate the best GitHub has to offer with the least amount of noise.
77

88
The repo includes an `index.html` file (so it can render a web page), two GitHub Actions workflows, and a CSS stylesheet dependency.
9+
10+
11+
12+
13+
----------
14+
## 🐳 Docker Image Migration to HelmHubIO
15+
16+
17+
This repository automates the migration of Docker images from a source Docker Hub user (e.g. bitnamilegacy) to a destination user (e.g. helmhubio) using GitHub Actions.
18+
19+
The workflow performs the following in sequence:
20+
1. Fetch all repositories from the source user on Docker Hub.
21+
2. List tags for each repository, filtering out SHA-based tags (e.g. sha256-*).
22+
3. Select the most recent valid tag (e.g. 2.4.65-debian-12-r2).
23+
4. Check if the image and tag already exist in the destination repository (helmhubio).
24+
- If the image exists, it’s skipped.
25+
- If not, it proceeds to migrate.
26+
5. Pull the image from the source repository.
27+
6. Tag and push the image to the destination repository on Docker Hub.
28+
7. Continues until all repositories have been processed.
29+
30+
The migration runs manually via GitHub Actions → “Run workflow”.
31+
`.github/workflows/migrate-images.yml`
32+
33+
#### Notes
34+
35+
- The script ensures idempotency — it will not re-upload images that already exist.
36+
- Non-versioned tags (SHA-style) are automatically skipped.
37+
- Pagination support ensures all repositories are fetched, not just the first 100.

migrate-images.sh

Whitespace-only changes.

0 commit comments

Comments
 (0)