Skip to content

Commit

Permalink
Apply to all workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
nvuillam committed Oct 20, 2024
1 parent af6d8d1 commit 8594435
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 141 deletions.
32 changes: 10 additions & 22 deletions .github/workflows/deploy-BETA-flavors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 #
Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/deploy-BETA-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down
44 changes: 16 additions & 28 deletions .github/workflows/deploy-BETA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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 #
Expand Down
71 changes: 30 additions & 41 deletions .github/workflows/deploy-RELEASE-flavors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 #
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/deploy-RELEASE-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
#####################################
Expand Down
66 changes: 30 additions & 36 deletions .github/workflows/deploy-RELEASE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 8594435

Please sign in to comment.