Skip to content

Commit

Permalink
Use docker/build-push-action@ in CI instead of upload-docker.sh (#2342)
Browse files Browse the repository at this point in the history
* Use docker/build-push-action@

* Deprecate upload-docker.sh

* pipeline

* Remove upload-docker.sh

* pwd

* Push: true

* Use build-push-action for build deploy dev

* Update dev & beta CI jobs

* More

* Update release jobs

* changelog

* cspell

* auto-update fix
  • Loading branch information
nvuillam authored Feb 11, 2023
1 parent 6428340 commit 2c78dd0
Show file tree
Hide file tree
Showing 12 changed files with 295 additions and 947 deletions.
663 changes: 0 additions & 663 deletions .automation/upload-docker.sh

This file was deleted.

11 changes: 4 additions & 7 deletions .github/linters/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@
"agentlib",
"agentpath",
"airbnb",
"akhilerm",
"alignat",
"alnum",
"analyse",
Expand Down Expand Up @@ -1097,6 +1098,7 @@
"repositoryformatversion",
"reqparse",
"reqs",
"retagging",
"retrocompatibility",
"returncode",
"returnrules",
Expand Down Expand Up @@ -1366,11 +1368,6 @@
"\u03f0linters",
"\u04bbcoffeescript",
"\u0636clojure",
"\u077bcbad",
"Deneuve",
"Etienne",
"davidjeddy",
"gotit",
"pjungermann"
"\u077bcbad"
]
}
}
19 changes: 16 additions & 3 deletions .github/workflows/auto-update-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,22 @@ jobs:
###################################
# Build image locally for testing #
###################################
- name: Build image
shell: bash
run: docker buildx build --platform linux/amd64 --build-arg "BUILD_DATE=${BUILD_DATE}" --build-arg "BUILD_REVISION=auto_update_${GITHUB_SHA}" --build-arg "BUILD_VERSION=auto_update_${GITHUB_SHA}" --no-cache -t oxsecurity/megalinter:auto_update_${GITHUB_SHA} --load . | while read line ; do echo "$(date +'%H:%M:%S')| $line"; done;
- name: Build MegaLinter Docker Image
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
platforms: linux/amd64
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=auto_update_${{ github.sha }}
BUILD_VERSION=auto_update_${{ github.sha }}
load: true
push: false
secrets: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
tags: |
oxsecurity/megalinter:auto_update_${{ github.sha }}
timeout-minutes: 60

#####################################
Expand Down
65 changes: 35 additions & 30 deletions .github/workflows/deploy-BETA-flavors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,37 +82,42 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3

###################################
# Run Deploy script for Dockerhub #
###################################
- name: Deploy beta image to DockerHub
env:
# Set the Env Vars
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_REPO: oxsecurity/megalinter-${{ matrix.flavor }}
IMAGE_VERSION: beta
DOCKERFILE_PATH: flavors/${{ matrix.flavor }}/Dockerfile
DOCKER_BUILD_PLATFORMS: linux/amd64
REGISTRY: Docker
shell: bash
run: .automation/upload-docker.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

###################################################
# Run Deploy script for GitHub Container Registry #
###################################################
- name: Deploy beta image to GitHub Container Registry
env:
# Set the Env Vars
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
IMAGE_REPO: oxsecurity/megalinter-${{ matrix.flavor }}
IMAGE_VERSION: beta
DOCKERFILE_PATH: flavors/${{ matrix.flavor }}/Dockerfile
DOCKER_BUILD_PLATFORMS: linux/amd64
REGISTRY: GCR
shell: bash
run: .automation/upload-docker.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Image
uses: docker/build-push-action@v3
with:
context: .
file: flavors/${{ matrix.flavor }}/Dockerfile
platforms: linux/amd64
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=${{ github.sha }}
load: false
push: true
secrets: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
tags: |
oxsecurity/megalinter-${{ matrix.flavor }}:beta
ghcr.io/oxsecurity/megalinter-${{ matrix.flavor }}:beta
# Free disk space
- name: Free Disk space
Expand Down
91 changes: 35 additions & 56 deletions .github/workflows/deploy-BETA-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,65 +109,44 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3

###################################
# Run Deploy script for Dockerhub #
###################################
- name: Deploy Beta image to DockerHub
env:
# Set the Env Vars
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}
IMAGE_VERSION: beta
DOCKERFILE_PATH: linters/${{ matrix.linter }}/Dockerfile
DOCKER_BUILD_PLATFORMS: linux/amd64
REGISTRY: Docker
shell: bash
run: .automation/upload-docker.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Deploy ${{ needs.prepare.outputs.unique_docker_image_name }} image to DockerHub
env:
# Set the Env Vars
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}
IMAGE_VERSION: "${{ needs.prepare.outputs.unique_docker_image_name }}"
DOCKERFILE_PATH: linters/${{ matrix.linter }}/Dockerfile
DOCKER_BUILD_PLATFORMS: linux/amd64
REGISTRY: Docker
ALWAYS_BUILD: force
shell: bash
run: .automation/upload-docker.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

###################################################
# Run Deploy script for GitHub Container Registry #
###################################################
- name: Deploy Beta image to GitHub Container Registry
env:
# Set the Env Vars
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}
IMAGE_VERSION: beta
DOCKERFILE_PATH: linters/${{ matrix.linter }}/Dockerfile
DOCKER_BUILD_PLATFORMS: linux/amd64
REGISTRY: GCR
shell: bash
run: .automation/upload-docker.sh
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Deploy ${{ needs.prepare.outputs.unique_docker_image_name }} image to GitHub Container Registry
env:
# Set the Env Vars
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}
IMAGE_VERSION: "${{ needs.prepare.outputs.unique_docker_image_name }}"
DOCKERFILE_PATH: linters/${{ matrix.linter }}/Dockerfile
DOCKER_BUILD_PLATFORMS: linux/amd64
REGISTRY: GCR
ALWAYS_BUILD: force
shell: bash
run: .automation/upload-docker.sh
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Image
uses: docker/build-push-action@v3
with:
context: .
file: linters/${{ matrix.linter }}/Dockerfile
platforms: linux/amd64
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=${{ github.sha }}
load: false
push: true
secrets: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
tags: |
oxsecurity/megalinter-only-${{ matrix.linter }}:beta
oxsecurity/megalinter-only-${{ matrix.linter }}:{{ needs.prepare.outputs.unique_docker_image_name }}
ghcr.io/oxsecurity/megalinter-only-${{ matrix.linter }}:beta
ghcr.io/oxsecurity/megalinter-only-${{ matrix.linter }}:{{ needs.prepare.outputs.unique_docker_image_name }}
#####################################
# Run Linter test cases #
Expand Down
67 changes: 36 additions & 31 deletions .github/workflows/deploy-BETA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
########################################################
- uses: actions/[email protected]
with:
node-version: "12.x"
node-version: "16.x"
registry-url: "https://registry.npmjs.org"
- run: cd mega-linter-runner && yarn install --frozen-lockfile
- run: cd mega-linter-runner && BETAID=$(date '+%Y%m%d%H%M') && npm version prerelease --preid="beta$BETAID"
Expand All @@ -71,37 +71,42 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

#####################
# Run Deploy script #
#####################
- name: Deploy beta image to DockerHub
env:
# Set the Env Vars
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_REPO: oxsecurity/megalinter
IMAGE_VERSION: beta
DOCKERFILE_PATH: Dockerfile
DOCKER_BUILD_PLATFORMS: linux/amd64
REGISTRY: Docker
shell: bash
run: .automation/upload-docker.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

#############################
# Run Deploy script for GPR #
#############################
- name: Deploy beta image to GitHub Container Registry
env:
# Set the Env Vars
GCR_USERNAME: ${{ secrets.GCR_USERNAME }}
GCR_TOKEN: ${{ secrets.GCR_PASSWORD }}
IMAGE_REPO: oxsecurity/megalinter
IMAGE_VERSION: beta
DOCKERFILE_PATH: Dockerfile
DOCKER_BUILD_PLATFORMS: linux/amd64
REGISTRY: GCR
shell: bash
run: .automation/upload-docker.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build & Push Docker Image
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
platforms: linux/amd64
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=${{ github.sha }}
load: false
push: true
secrets: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
tags: |
oxsecurity/megalinter:beta
ghcr.io/oxsecurity/megalinter:beta
###############################
# Run tests for code coverage #
Expand Down
55 changes: 37 additions & 18 deletions .github/workflows/deploy-DEV-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,46 @@ jobs:
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################

- name: Checkout Code
uses: actions/checkout@v3

#####################
# Run Deploy script #
#####################
- name: Deploy ${{ needs.prepare.outputs.tag }} image to DockerHub
env:
# Set the Env Vars
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_REPO: oxsecurity/megalinter-only-${{ matrix.linter }}
IMAGE_VERSION: ${{ needs.prepare.outputs.tag }}
DOCKERFILE_PATH: linters/${{ matrix.linter }}/Dockerfile
DOCKER_BUILD_PLATFORMS: linux/amd64
REGISTRY: Docker
shell: bash
run: .automation/upload-docker.sh
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Image
uses: docker/build-push-action@v3
with:
context: .
file: linters/${{ matrix.linter }}/Dockerfile
platforms: linux/amd64
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
BUILD_REVISION=${{ github.sha }}
BUILD_VERSION=${{ github.sha }}
load: false
push: true
secrets: |
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
tags: |
oxsecurity/megalinter-only-${{ matrix.linter }}:${{ needs.prepare.outputs.tag }}
ghcr.io/oxsecurity/megalinter-only-${{ matrix.linter }}:${{ needs.prepare.outputs.tag }}
#####################################
# Run Linter test cases #
Expand Down
Loading

0 comments on commit 2c78dd0

Please sign in to comment.