From 0c99a5551725667b364f90cdd752227a7f98cbd7 Mon Sep 17 00:00:00 2001 From: nvuillam Date: Sat, 12 Oct 2024 22:42:42 +0200 Subject: [PATCH] Update Beta generation --- .github/workflows/deploy-BETA-flavors.yml | 65 ++++++++++++++++++---- .github/workflows/deploy-BETA-linters.yml | 34 +++++++++--- .github/workflows/deploy-BETA.yml | 66 +++++++++++++++++++---- 3 files changed, 140 insertions(+), 25 deletions(-) diff --git a/.github/workflows/deploy-BETA-flavors.yml b/.github/workflows/deploy-BETA-flavors.yml index 95cee454e44..37921d4f684 100644 --- a/.github/workflows/deploy-BETA-flavors.yml +++ b/.github/workflows/deploy-BETA-flavors.yml @@ -94,19 +94,30 @@ jobs: id: meta with: images: | - ${{ github.repository }}-${{ matrix.flavor }} ghcr.io/${{ github.repository }}-${{ matrix.flavor }} flavor: | latest=false prefix=beta tags: | type=raw,value= + + - name: Docker Metadata action (Docker Hub) + uses: docker/metadata-action@v5.5.1 + id: meta-dhub + with: + images: | + ${{ github.repository }}-${{ matrix.flavor }} + flavor: | + latest=false + prefix=beta + tags: | + type=raw,value= + - name: Docker Metadata action (Worker) uses: docker/metadata-action@v5.5.1 id: meta-w with: images: | - name=${{ github.repository }}-worker-${{ matrix.flavor }},enable=false name=ghcr.io/${{ github.repository }}-worker-${{ matrix.flavor }} flavor: | latest=false @@ -114,6 +125,18 @@ jobs: tags: | type=raw,value= + - name: Docker Metadata action (Worker Docker Hub) + uses: docker/metadata-action@v5.5.1 + id: meta-w-dhub + with: + images: | + name=${{ github.repository }}-worker-${{ matrix.flavor }},enable=false + flavor: | + latest=false + prefix=beta + tags: | + type=raw,value= + - name: Set up QEMU uses: docker/setup-qemu-action@v3 if: ${{ ( ( runner.arch != 'X64' || runner.os != 'Linux' ) && matrix.platform == 'linux/amd64' ) || matrix.platform != 'linux/amd64' }} @@ -121,12 +144,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -172,7 +189,37 @@ jobs: push: ${{ github.event_name != 'pull_request' }} secrets: | GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ steps.meta-w.outputs.tags }} + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + # Copy ghrc.io image to Docker Hub (main image) + - name: Pull image from GHCR + run: docker pull ${{ steps.meta.outputs.tags[0] }} + - name: Tag image for Docker Hub + run: docker tag ${{ steps.meta.outputs.tags[0] }} ${{ steps.meta-dhub.outputs.tags[0] }} + - name: Push image to Docker Hub + run: docker push ${{ steps.meta-dhub.outputs.tags[0] }} + + # Copy ghrc.io image to Docker Hub (server) + - name: Pull image from GHCR + run: docker pull ${{ steps.meta-s.outputs.tags[0] }} + - name: Tag image for Docker Hub + run: docker tag ${{ steps.meta-s.outputs.tags[0] }} ${{ steps.meta-s-dhub.outputs.tags[0] }} + - name: Push image to Docker Hub + run: docker push ${{ steps.meta-s-dhub.outputs.tags[0] }} + + # Copy ghrc.io image to Docker Hub (worker) + - name: Pull image from GHCR + run: docker pull ${{ steps.meta-w.outputs.tags[0] }} + - name: Tag image for Docker Hub + run: docker tag ${{ steps.meta-w.outputs.tags[0] }} ${{ steps.meta-w-dhub.outputs.tags[0] }} + - name: Push image to Docker Hub + run: docker push ${{ steps.meta-w-dhub.outputs.tags[0] }} ############################################## # Check Docker image security with Trivy # diff --git a/.github/workflows/deploy-BETA-linters.yml b/.github/workflows/deploy-BETA-linters.yml index b3a9df5cfb6..35aed713bd2 100644 --- a/.github/workflows/deploy-BETA-linters.yml +++ b/.github/workflows/deploy-BETA-linters.yml @@ -195,7 +195,6 @@ jobs: id: meta with: images: | - ${{ github.repository }}-only-${{ matrix.linter }} ghcr.io/${{ github.repository }}-only-${{ matrix.linter }} flavor: | latest=false @@ -204,6 +203,19 @@ jobs: type=raw,value= type=raw,value={{date 'YYYYMMDD_HHmm'}} + - name: Docker Metadata action (Docker hub) + uses: docker/metadata-action@v5.5.1 + id: meta-dhub + with: + images: | + ${{ github.repository }}-only-${{ matrix.linter }} + flavor: | + latest=false + prefix=beta + tags: | + type=raw,value= + type=raw,value={{date 'YYYYMMDD_HHmm'}} + - name: Set up QEMU uses: docker/setup-qemu-action@v3 if: ${{ ( ( runner.arch != 'X64' || runner.os != 'Linux' ) && matrix.platform == 'linux/amd64' ) || matrix.platform != 'linux/amd64' }} @@ -211,12 +223,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -255,6 +261,20 @@ jobs: docker run -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=text -e OUTPUT_FOLDER=${{ github.sha }} -e OUTPUT_DETAIL=detailed -e GITHUB_SHA=${{ github.sha }} -e GITHUB_REPOSITORY=${GITHUB_REPOSITORY} -e GITHUB_BRANCH=${GITHUB_BRANCH} -e GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" -e TEST_KEYWORDS="${TEST_KEYWORDS_TO_USE}" -e MEGALINTER_VOLUME_ROOT="${GITHUB_WORKSPACE}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint ${{ fromJson(steps.meta.outputs.json).tags[0]}} timeout-minutes: 30 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + # Copy ghrc.io image to Docker Hub (main image) + - name: Pull image from GHCR + run: docker pull ${{ steps.meta.outputs.tags[0] }} + - name: Tag image for Docker Hub + run: docker tag ${{ steps.meta.outputs.tags[0] }} ${{ steps.meta-dhub.outputs.tags[0] }} + - name: Push image to Docker Hub + run: docker push ${{ steps.meta-dhub.outputs.tags[0] }} + ############################################## # Check Docker image security with Trivy # ############################################## diff --git a/.github/workflows/deploy-BETA.yml b/.github/workflows/deploy-BETA.yml index 4f2eb1358fe..ead69d8639c 100644 --- a/.github/workflows/deploy-BETA.yml +++ b/.github/workflows/deploy-BETA.yml @@ -83,43 +83,61 @@ jobs: id: meta with: images: | - name=${{ github.repository }} name=ghcr.io/${{ github.repository }} tags: | type=raw,value=beta + - name: Docker Metadata action (Docker Hub) + uses: docker/metadata-action@v5.5.1 + id: meta-dhub + with: + images: | + name=${{ github.repository }} + tags: | + type=raw,value=beta + - name: Docker Metadata action (Server) uses: docker/metadata-action@v5.5.1 id: meta-s with: images: | - name=${{ github.repository }}-server,enable=false name=ghcr.io/${{ github.repository }}-server tags: | type=raw,value=beta + - name: Docker Metadata action (Server Docker Hub) + uses: docker/metadata-action@v5.5.1 + id: meta-s-dhub + with: + images: | + name=${{ github.repository }}-server,enable=false + tags: | + type=raw,value=beta + - name: Docker Metadata action (Worker) uses: docker/metadata-action@v5.5.1 id: meta-w with: images: | - name=${{ github.repository }}-worker,enable=false name=ghcr.io/${{ github.repository }}-worker tags: | type=raw,value=beta + - name: Docker Metadata action (Worker Server) + uses: docker/metadata-action@v5.5.1 + id: meta-w-dhub + with: + images: | + name=${{ github.repository }}-worker,enable=false + tags: | + type=raw,value=beta + - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -176,6 +194,36 @@ jobs: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} tags: ${{ steps.meta-w.outputs.tags }} + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + # Copy ghrc.io image to Docker Hub (main image) + - name: Pull image from GHCR + run: docker pull ${{ steps.meta.outputs.tags[0] }} + - name: Tag image for Docker Hub + run: docker tag ${{ steps.meta.outputs.tags[0] }} ${{ steps.meta-dhub.outputs.tags[0] }} + - name: Push image to Docker Hub + run: docker push ${{ steps.meta-dhub.outputs.tags[0] }} + + # Copy ghrc.io image to Docker Hub (server) + - name: Pull image from GHCR + run: docker pull ${{ steps.meta-s.outputs.tags[0] }} + - name: Tag image for Docker Hub + run: docker tag ${{ steps.meta-s.outputs.tags[0] }} ${{ steps.meta-s-dhub.outputs.tags[0] }} + - name: Push image to Docker Hub + run: docker push ${{ steps.meta-s-dhub.outputs.tags[0] }} + + # Copy ghrc.io image to Docker Hub (worker) + - name: Pull image from GHCR + run: docker pull ${{ steps.meta-w.outputs.tags[0] }} + - name: Tag image for Docker Hub + run: docker tag ${{ steps.meta-w.outputs.tags[0] }} ${{ steps.meta-w-dhub.outputs.tags[0] }} + - name: Push image to Docker Hub + run: docker push ${{ steps.meta-w-dhub.outputs.tags[0] }} + # ############################### # # Run tests for code coverage # # ###############################