Skip to content

Commit b60b7ba

Browse files
authored
Update wp pipeline (#7)
* ci: update pipeline build args * fix: remove whitesapce trailing checker * patch: remove branching naming hook * ci: add josa registry to pipelines
1 parent 671127b commit b60b7ba

File tree

2 files changed

+48
-46
lines changed

2 files changed

+48
-46
lines changed

.woodpecker/build-latest-image.yaml

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,11 @@ when:
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

169
variables:
17-
- &docker_repo "josaorg/kutt"
10+
- &registry_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

5036
steps:
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
@@ -82,7 +80,7 @@ steps:
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
@@ -96,5 +94,5 @@ steps:
9694
when:
9795
- status: failure
9896
depends_on:
99-
- check-for-leaks
97+
- run-pre-commit-hooks
10098
- build-latest-image

.woodpecker/build-stable-image.yaml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,9 @@ when:
99
exclude: [main]
1010

1111
variables:
12-
- &docker_repo "josaorg/kutt"
12+
- &registry_url "https://registry.cloud.josa.ngo"
13+
- &docker_repo "registry.cloud.josa.ngo/library/kutt"
1314
- &slack_channel "builds"
14-
# Docker build arguments template
15-
- &build_args_template
16-
- CI_COMMIT_SHA=${CI_COMMIT_SHA}
17-
- CI_BUILD_NUMBER=${CI_BUILD_NUMBER}
18-
- CI_BUILD_LINK=${CI_BUILD_LINK}
19-
- CI_COMMIT_LINK=${CI_COMMIT_LINK}
20-
- CI_REPO_LINK=${CI_REPO_LINK}
21-
- CI_BUILD_FINISHED=${CI_BUILD_FINISHED}
2215
# Success message template
2316
- &success_message >
2417
✅ *SUCCESS* - Stable Build #{{ build.number }}
@@ -43,28 +36,39 @@ variables:
4336
• <{{ build.link }}|View Build>
4437

4538
steps:
46-
# Security check - scan for secrets/credentials
47-
- name: check-for-leaks
48-
image: zricethezav/gitleaks:v8.18.4
49-
commands:
50-
- gitleaks detect --source . --verbose
39+
- name: run-pre-commit-hooks
40+
image: josaorg/pre-commit-runner
41+
settings:
42+
args: "--all-files"
43+
skip: "end-of-file-fixer, yamllint, trailing-whitespace"
5144

5245
# Build stable image (main branch only)
5346
- name: build-stable-image
5447
image: woodpeckerci/plugin-docker-buildx
5548
settings:
5649
repo: *docker_repo
50+
registry: *registry_url
5751
dockerfile: ./Dockerfile
5852
tags:
5953
- ${CI_COMMIT_SHA:-latest}
6054
- stable
6155
username:
62-
from_secret: DOCKER_HUB_USERNAME
56+
from_secret: REGISTRY_USERNAME
6357
password:
64-
from_secret: DOCKER_HUB_PASSWORD
65-
build_args: *build_args_template
58+
from_secret: REGISTRY_SECRET
59+
build_args:
60+
CI_REPO: "${CI_REPO}"
61+
CI_REPO_NAME: "${CI_REPO_NAME}"
62+
CI_REPO_URL: "${CI_REPO_URL}"
63+
CI_COMMIT_SHA: "${CI_COMMIT_SHA}"
64+
CI_COMMIT_REF: "${CI_COMMIT_REF}"
65+
CI_PIPELINE_URL: "${CI_PIPELINE_URL}"
66+
CI_PIPELINE_CREATED: "${CI_PIPELINE_CREATED}"
67+
CI_PREV_PIPELINE_URL: "${CI_PREV_PIPELINE_URL}"
68+
CI_PIPELINE_NUMBER: "${CI_PIPELINE_NUMBER}"
69+
6670
depends_on:
67-
- check-for-leaks
71+
- run-pre-commit-hooks
6872

6973
# Slack notification for stable build success
7074
- name: notify-slack-stable-success
@@ -77,7 +81,7 @@ steps:
7781
when:
7882
- status: success
7983
depends_on:
80-
- check-for-leaks
84+
- run-pre-commit-hooks
8185
- build-stable-image
8286

8387
# Slack notification for stable build failure
@@ -91,5 +95,5 @@ steps:
9195
when:
9296
- status: failure
9397
depends_on:
94-
- check-for-leaks
98+
- run-pre-commit-hooks
9599
- build-stable-image

0 commit comments

Comments
 (0)