diff --git a/.github/workflows/deploy-BETA-flavors.yml b/.github/workflows/deploy-BETA-flavors.yml index bb5119fc655..d4f35d1f76d 100644 --- a/.github/workflows/deploy-BETA-flavors.yml +++ b/.github/workflows/deploy-BETA-flavors.yml @@ -175,6 +175,12 @@ jobs: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} tags: ${{ steps.meta.outputs.tags }} + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "${{ steps.meta.outputs.tags }}", "target-image": "${{ steps.meta-dhub.outputs.tags }}" }' + - name: Build Worker Image uses: docker/build-push-action@v6 with: @@ -192,29 +198,11 @@ jobs: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} tags: ${{ steps.meta-w.outputs.tags }} - - name: Login to Docker Hub - uses: docker/login-action@v3 + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - # Copy ghrc.io image to Docker Hub (main image) - - name: Debug output - run: "echo \"Tag steps.meta.outputs.tags: ${{ steps.meta.outputs.tags }}\"" - - name: Pull image from GHCR - run: docker system prune -a --volumes --force && docker pull "${{ steps.meta.outputs.tags }}" - - name: Tag image for Docker Hub - run: docker tag "${{ steps.meta.outputs.tags }}" "${{ steps.meta-dhub.outputs.tags }}" - - name: Push image to Docker Hub - run: docker push "${{ steps.meta-dhub.outputs.tags }}" - - # Copy ghrc.io image to Docker Hub (worker) - - name: Pull image from GHCR - run: docker system prune -a --volumes --force && docker pull "${{ steps.meta-w.outputs.tags }}" - - name: Tag image for Docker Hub - run: docker tag "${{ steps.meta-w.outputs.tags }}" "${{ steps.meta-w-dhub.outputs.tags }}" - - name: Push image to Docker Hub - run: docker push "${{ steps.meta-w-dhub.outputs.tags }}" + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "${{ steps.meta-w.outputs.tags }}", "target-image": "${{ steps.meta-w-dhub.outputs.tags }}" }' ############################################## # Check Docker image security with Trivy # diff --git a/.github/workflows/deploy-BETA-linters.yml b/.github/workflows/deploy-BETA-linters.yml index 78f53033125..5f4afe993c4 100644 --- a/.github/workflows/deploy-BETA-linters.yml +++ b/.github/workflows/deploy-BETA-linters.yml @@ -262,21 +262,11 @@ 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 + - name: Invoke Mirror docker image workflow (Standalone linter image) + uses: benc-uk/workflow-dispatch@v1 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - # Copy ghrc.io image to Docker Hub (main image) - - name: Debug output - run: "echo \"Tag steps.meta.outputs.tags: ${{ fromJson(steps.meta-dhub.outputs.json).tags[0]}}\"" - - name: Pull image from GHCR - run: docker system prune -a --volumes --force && docker pull "${{ fromJson(steps.meta.outputs.json).tags[0]}}" - - name: Tag image for Docker Hub - run: docker tag "${{ fromJson(steps.meta.outputs.json).tags[0]}}" "${{ fromJson(steps.meta-dhub.outputs.json).tags[0]}}" - - name: Push image to Docker Hub - run: docker push "${{ fromJson(steps.meta-dhub.outputs.json).tags[0]}}" + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "${{ fromJson(steps.meta.outputs.json).tags[0]}}", "target-image": "${{ fromJson(steps.meta-dhub.outputs.json).tags[0]}}" }' ############################################## # Check Docker image security with Trivy # diff --git a/.github/workflows/deploy-BETA.yml b/.github/workflows/deploy-BETA.yml index b89927094ab..bb295e2137f 100644 --- a/.github/workflows/deploy-BETA.yml +++ b/.github/workflows/deploy-BETA.yml @@ -162,6 +162,12 @@ jobs: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} tags: ${{ steps.meta-s.outputs.tags }} + - name: Invoke Mirror docker image workflow (Server image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "${{ steps.meta-s.outputs.tags }}", "target-image": "${{ steps.meta-s-dhub.outputs.tags }}" }' + - name: Build & Push Docker Image uses: docker/build-push-action@v6 with: @@ -178,6 +184,12 @@ jobs: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} tags: ${{ steps.meta.outputs.tags }} + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "${{ steps.meta.outputs.tags }}", "target-image": "${{ steps.meta-dhub.outputs.tags }}" }' + - name: Build & Push Docker Worker Image uses: docker/build-push-action@v6 with: @@ -195,35 +207,11 @@ jobs: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} tags: ${{ steps.meta-w.outputs.tags }} - - name: Login to Docker Hub - uses: docker/login-action@v3 + - name: Invoke Mirror docker image workflow (Worker image) + uses: benc-uk/workflow-dispatch@v1 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 system prune -a --volumes --force && docker pull "${{ steps.meta.outputs.tags }}" - - name: Tag image for Docker Hub - run: docker tag "${{ steps.meta.outputs.tags }}" "${{ steps.meta-dhub.outputs.tags }}" - - name: Push image to Docker Hub - run: docker push "${{ steps.meta-dhub.outputs.tags }}" - - # Copy ghrc.io image to Docker Hub (server) - - name: Pull image from GHCR - run: docker system prune -a --volumes --force && docker pull "${{ steps.meta-s.outputs.tags }}" - - name: Tag image for Docker Hub - run: docker tag "${{ steps.meta-s.outputs.tags }}" "${{ steps.meta-s-dhub.outputs.tags }}" - - name: Push image to Docker Hub - run: docker push "${{ steps.meta-s-dhub.outputs.tags }}" - - # Copy ghrc.io image to Docker Hub (worker) - - name: Pull image from GHCR - run: docker system prune -a --volumes --force && docker pull "${{ steps.meta-w.outputs.tags }}" - - name: Tag image for Docker Hub - run: docker tag "${{ steps.meta-w.outputs.tags }}" "${{ steps.meta-w-dhub.outputs.tags }}" - - name: Push image to Docker Hub - run: docker push "${{ steps.meta-w-dhub.outputs.tags }}" + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "${{ steps.meta-w.outputs.tags }}", "target-image": "${{ steps.meta-w-dhub.outputs.tags }}" }' # ############################### # # Run tests for code coverage # diff --git a/.github/workflows/deploy-RELEASE-flavors.yml b/.github/workflows/deploy-RELEASE-flavors.yml index 105c90a01f3..a503b5100a5 100644 --- a/.github/workflows/deploy-RELEASE-flavors.yml +++ b/.github/workflows/deploy-RELEASE-flavors.yml @@ -106,6 +106,22 @@ jobs: ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:${{ github.event.release.tag_name }} ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:latest + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:v8", "target-image": "docker.io/oxsecurity/megalinter-${{ matrix.flavor }}:v8" }' + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:v8", "target-image": "docker.io/oxsecurity/megalinter-${{ matrix.flavor }}:${{ github.event.release.tag_name }}" }' + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:v8", "target-image": "docker.io/oxsecurity/megalinter-${{ matrix.flavor }}:latest" }' + - name: Build Worker Image uses: docker/build-push-action@v6 with: @@ -126,49 +142,22 @@ jobs: ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:${{ github.event.release.tag_name }} ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:latest - - name: Login to Docker Hub - uses: docker/login-action@v3 + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 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 system prune -a --volumes --force && docker pull ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:v8 - - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:v8 docker.io/oxsecurity/megalinter-${{ matrix.flavor }}:v8 - - name: Push image to Docker Hub v8 - run: docker push docker.io/oxsecurity/megalinter-${{ matrix.flavor }}:v8 - - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:v8 docker.io/oxsecurity/megalinter-${{ matrix.flavor }}:${{ github.event.release.tag_name }} - - name: Push image to Docker Hub ${{ github.event.release.tag_name }} - run: docker push docker.io/oxsecurity/megalinter-${{ matrix.flavor }}:${{ github.event.release.tag_name }} - - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:v8 docker.io/oxsecurity/megalinter-${{ matrix.flavor }}:latest - - name: Push image to Docker Hub latest - run: docker push docker.io/oxsecurity/megalinter-${{ matrix.flavor }}:latest - - # Copy ghrc.io image to Docker Hub (worker) - - name: Pull image from GHCR - run: docker system prune -a --volumes --force && docker pull ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:v8 - - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:v8 docker.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:v8 - - name: Push image to Docker Hub v8 - run: docker push docker.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:v8 - - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:v8 docker.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:${{ github.event.release.tag_name }} - - name: Push image to Docker Hub ${{ github.event.release.tag_name }} - run: docker push docker.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:${{ github.event.release.tag_name }} + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:v8", "target-image": "docker.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:v8" }' + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:v8", "target-image": "docker.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:${{ github.event.release.tag_name }}" }' + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:v8", "target-image": "docker.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:latest" }' - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:v8 docker.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:latest - - name: Push image to Docker Hub latest - run: docker push docker.io/oxsecurity/megalinter-worker-${{ matrix.flavor }}:latest ############################################## # Check Docker image security with Trivy # diff --git a/.github/workflows/deploy-RELEASE-linters.yml b/.github/workflows/deploy-RELEASE-linters.yml index 086335e6687..17931925d8a 100644 --- a/.github/workflows/deploy-RELEASE-linters.yml +++ b/.github/workflows/deploy-RELEASE-linters.yml @@ -212,6 +212,22 @@ jobs: ghcr.io/oxsecurity/megalinter-only-${{ matrix.linter }}:${{ github.event.release.tag_name }} ghcr.io/oxsecurity/megalinter-only-${{ matrix.linter }}:latest + - name: Invoke Mirror docker image workflow (Standalone image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-only-${{ matrix.linter }}:v8", "target-image": "docker.io/oxsecurity/megalinter-only-${{ matrix.linter }}:v8" }' + - name: Invoke Mirror docker image workflow (Standalone image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-only-${{ matrix.linter }}:v8", "target-image": "docker.io/oxsecurity/megalinter-only-${{ matrix.linter }}:${{ github.event.release.tag_name }}" }' + - name: Invoke Mirror docker image workflow (Standalone image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-only-${{ matrix.linter }}:v8", "target-image": "docker.io/oxsecurity/megalinter-only-${{ matrix.linter }}:latest" }' + ##################################### # Run Linter test cases # ##################################### diff --git a/.github/workflows/deploy-RELEASE.yml b/.github/workflows/deploy-RELEASE.yml index a9d5ce9bbd5..769241a620d 100644 --- a/.github/workflows/deploy-RELEASE.yml +++ b/.github/workflows/deploy-RELEASE.yml @@ -102,6 +102,22 @@ jobs: ghcr.io/oxsecurity/megalinter:${{ github.event.release.tag_name }} ghcr.io/oxsecurity/megalinter:latest + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter:v8", "target-image": "docker.io/oxsecurity/megalinter:v8" }' + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter:v8", "target-image": "docker.io/oxsecurity/megalinter:${{ github.event.release.tag_name }}" }' + - name: Invoke Mirror docker image workflow (Main image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter:v8", "target-image": "docker.io/oxsecurity/megalinter:latest" }' + - name: Build Worker Image uses: docker/build-push-action@v6 with: @@ -122,43 +138,21 @@ jobs: ghcr.io/oxsecurity/megalinter-worker:${{ github.event.release.tag_name }} ghcr.io/oxsecurity/megalinter-worker:latest - - name: Login to Docker Hub - uses: docker/login-action@v3 + - name: Invoke Mirror docker image workflow (Worker image) + uses: benc-uk/workflow-dispatch@v1 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 system prune -a --volumes --force && docker pull ghcr.io/oxsecurity/megalinter:v8 - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter:v8 docker.io/oxsecurity/megalinter:v8 - - name: Push image to Docker Hub v8 - run: docker push docker.io/oxsecurity/megalinter:v8 - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter:v8 docker.io/oxsecurity/megalinter:${{ github.event.release.tag_name }} - - name: Push image to Docker Hub ${{ github.event.release.tag_name }} - run: docker push docker.io/oxsecurity/megalinter:${{ github.event.release.tag_name }} - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter:v8 docker.io/oxsecurity/megalinter:latest - - name: Push image to Docker Hub latest - run: docker push docker.io/oxsecurity/megalinter:latest - - # Copy ghrc.io image to Docker Hub (worker) - - name: Pull image from GHCR (Worker) - run: docker system prune -a --volumes --force && docker pull ghcr.io/oxsecurity/megalinter-worker:v8 - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter-worker:v8 docker.io/oxsecurity/megalinter-worker:v8 - - name: Push image to Docker Hub v8 - run: docker push docker.io/oxsecurity/megalinter-worker:v8 - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter-worker:v8 docker.io/oxsecurity/megalinter-worker:${{ github.event.release.tag_name }} - - name: Push image to Docker Hub ${{ github.event.release.tag_name }} - run: docker push docker.io/oxsecurity/megalinter-worker:${{ github.event.release.tag_name }} - - name: Tag image for Docker Hub - run: docker tag ghcr.io/oxsecurity/megalinter-worker:v8 docker.io/oxsecurity/megalinter-worker:latest - - name: Push image to Docker Hub latest - run: docker push docker.io/oxsecurity/megalinter-worker:latest + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-worker:v8", "target-image": "docker.io/oxsecurity/megalinter-worker:v8" }' + - name: Invoke Mirror docker image workflow (Worker image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-worker:v8", "target-image": "docker.io/oxsecurity/megalinter-worker:${{ github.event.release.tag_name }}" }' + - name: Invoke Mirror docker image workflow (Worker image) + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: mirror-docker-image.yml + inputs: '{ "source-image": "ghcr.io/oxsecurity/megalinter-worker:v8", "target-image": "docker.io/oxsecurity/megalinter-worker:latest" }' deploy_doc: runs-on: ubuntu-latest