55 - event : [pull_request]
66 # Only run when PR targets development or other branches (not main)
77 evaluate : ' CI_COMMIT_TARGET_BRANCH != "main"'
8- # Build the source branch
9- branch :
10- exclude : [main]
11- - event : [pull_request]
12- # Also build latest image when development branch creates PR to main
13- evaluate : ' CI_COMMIT_TARGET_BRANCH == "main" && CI_COMMIT_BRANCH == "development"'
14- branch : [development]
158
169variables :
17- - &docker_repo "josaorg/kutt"
10+ - ®istry_url "https://registry.cloud.josa.ngo"
11+ - &docker_repo "registry.cloud.josa.ngo/library/kutt"
1812 - &slack_channel "builds"
19- # Docker build arguments template
20- - &build_args_template
21- - CI_COMMIT_SHA=${CI_COMMIT_SHA}
22- - CI_BUILD_NUMBER=${CI_BUILD_NUMBER}
23- - CI_BUILD_LINK=${CI_BUILD_LINK}
24- - CI_COMMIT_LINK=${CI_COMMIT_LINK}
25- - CI_REPO_LINK=${CI_REPO_LINK}
26- - CI_BUILD_FINISHED=${CI_BUILD_FINISHED}
2713 # Success message template
2814 - &success_message >
2915 ✅ *SUCCESS* - Latest Build #{{ build.number }}
@@ -49,27 +35,39 @@ variables:
4935
5036steps :
5137 # Security check - scan for secrets/credentials
52- - name : check-for-leaks
53- image : zricethezav/gitleaks:v8.18.4
54- commands :
55- - gitleaks detect --source . --verbose
38+ - name : run-pre-commit-hooks
39+ image : josaorg/pre-commit-runner
40+ settings :
41+ args : " --all-files"
42+ skip : " end-of-file-fixer, yamllint, trailing-whitespace"
5643
5744 # Build latest image (development and other branches)
5845 - name : build-latest-image
5946 image : woodpeckerci/plugin-docker-buildx
6047 settings :
6148 repo : *docker_repo
49+ registry : *registry_url
6250 dockerfile : ./Dockerfile
6351 tags :
6452 - ${CI_COMMIT_SHA:-latest}
6553 - latest
6654 username :
67- from_secret : DOCKER_HUB_USERNAME
55+ from_secret : REGISTRY_USERNAME
6856 password :
69- from_secret : DOCKER_HUB_PASSWORD
70- build_args : *build_args_template
57+ from_secret : REGISTRY_SECRET
58+ build_args :
59+ CI_REPO : " ${CI_REPO}"
60+ CI_REPO_NAME : " ${CI_REPO_NAME}"
61+ CI_REPO_URL : " ${CI_REPO_URL}"
62+ CI_COMMIT_SHA : " ${CI_COMMIT_SHA}"
63+ CI_COMMIT_REF : " ${CI_COMMIT_REF}"
64+ CI_PIPELINE_URL : " ${CI_PIPELINE_URL}"
65+ CI_PIPELINE_CREATED : " ${CI_PIPELINE_CREATED}"
66+ CI_PREV_PIPELINE_URL : " ${CI_PREV_PIPELINE_URL}"
67+ CI_PIPELINE_NUMBER : " ${CI_PIPELINE_NUMBER}"
68+
7169 depends_on :
72- - check-for-leaks
70+ - run-pre-commit-hooks
7371
7472 # Slack notification for latest build success
7573 - name : notify-slack-latest-success
8280 when :
8381 - status : success
8482 depends_on :
85- - check-for-leaks
83+ - run-pre-commit-hooks
8684 - build-latest-image
8785
8886 # Slack notification for latest build failure
9694 when :
9795 - status : failure
9896 depends_on :
99- - check-for-leaks
97+ - run-pre-commit-hooks
10098 - build-latest-image
0 commit comments