ff
Some checks failed
lint, build and push / gitleaks (push) Successful in 3s
lint, build and push / hadolint (push) Failing after 2s
lint, build and push / build (push) Successful in 12s

This commit is contained in:
Michael Grote 2024-08-30 17:53:06 +02:00
parent 0d126c1d45
commit 735d3de6f9
3 changed files with 28 additions and 82 deletions

View file

@ -1,16 +1,39 @@
name: build name: "lint, build and push"
on: on:
push: push:
branches: [ master ] branches: [ master ]
pull_request: pull_request:
workflow_run:
workflows: [linter]
types:
- completed
# Variables: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables # Variables: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables
jobs: jobs:
gitleaks:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Gitleaks
uses: docker://zricethezav/gitleaks:v8.18.4
with:
args: detect --no-git --verbose --source ${{ github.workspace }}
hadolint:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run hadolint
uses: docker://pipelinecomponents/hadolint:0.26.4
with:
args: hadolint Dockerfile
# shellcheck: # https://github.com/marketplace/actions/shellcheck
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Run ShellCheck
# uses: sudo-bot/action-shellcheck@latest
# with:
# cli-args: "shell.sh"
build: build:
steps: steps:
- uses: https://github.com/actions/checkout@v4 - uses: https://github.com/actions/checkout@v4
@ -36,6 +59,3 @@ jobs:
file: ./Dockerfile file: ./Dockerfile
push: true push: true
tags: "registry.mgrote.net/${{ steps.meta.outputs.REPO_NAME }}:latest,registry.mgrote.net/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.extract_branch.outputs.REPO_BRANCH }}" tags: "registry.mgrote.net/${{ steps.meta.outputs.REPO_NAME }}:latest,registry.mgrote.net/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.extract_branch.outputs.REPO_BRANCH }}"
# depends on lint

View file

@ -1,33 +0,0 @@
name: linter
on:
push:
branches: [ master ]
pull_request:
jobs:
gitleaks:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Gitleaks
uses: docker://zricethezav/gitleaks:v8.18.4
with:
args: detect --no-git --verbose --source ${{ github.workspace }}
hadolint:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run hadolint
uses: docker://pipelinecomponents/hadolint:0.26.4
with:
args: hadolint Dockerfile
# shellcheck: # https://github.com/marketplace/actions/shellcheck
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# - name: Run ShellCheck
# uses: sudo-bot/action-shellcheck@latest
# with:
# cli-args: "shell.sh"

View file

@ -1,41 +0,0 @@
---
depends_on:
- lint
clone:
git:
image: "woodpeckerci/plugin-git:2.5.2"
settings:
depth: 9999 # wird benötigt um die Commits zählen zu können
lfs: false
partial: false
steps:
build_and_push: # damit dieser Step laufen kann muss das Repo in der Woodpecker-GUI "privilegiert" sein
image: "docker:27.2.0"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
commands:
# https://unix.stackexchange.com/questions/748633/error-multiple-platforms-feature-is-currently-not-supported-for-docker-driver
- docker buildx create --use --platform=linux/amd64 --name multi-platform-builder
- docker buildx inspect --bootstrap
- |
docker buildx build \
--no-cache \
--platform=linux/amd64 \
--push \
--tag registry.mgrote.net/${CI_REPO_NAME}:${CI_COMMIT_BRANCH} \
--tag registry.mgrote.net/${CI_REPO_NAME}:latest \
--label org.opencontainers.image.url=$CI_REPO_URL \
--label org.opencontainers.image.source=$CI_REPO_URL \
--label org.opencontainers.image.revision=$CI_COMMIT_SHA \
--label org.opencontainers.image.created=$DATE \
--file Dockerfile .
when:
- event: [push, pull_request, cron, manual]
evaluate: 'CI_COMMIT_AUTHOR_EMAIL != "renovate@mgrote.net"'
...
# händisch:
# docker build . -t registry.mgrote.net/allzweckcontainer:latest
# docker push registry.mgrote.net/allzweckcontainer:latest