Skip to content

Commit 8f45ac4

Browse files
committed
build(wp): add pipeline files
1 parent fc832d7 commit 8f45ac4

File tree

2 files changed

+197
-0
lines changed

2 files changed

+197
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
when:
2+
- event: [push, manual]
3+
branch:
4+
exclude: [main]
5+
- event: [pull_request]
6+
# Only run when PR targets development or other branches (not main)
7+
evaluate: 'CI_COMMIT_TARGET_BRANCH != "main"'
8+
9+
variables:
10+
- &registry_url "https://registry.cloud.josa.ngo"
11+
- &docker_repo "registry.cloud.josa.ngo/library/kutt"
12+
- &slack_channel "builds"
13+
# Success message template
14+
- &success_message >
15+
✅ *SUCCESS* - Latest Build #{{ build.number }}
16+
17+
📁 *Repository:* {{ repo.name }}
18+
🌿 *Branch:* {{ build.branch }}
19+
📝 *Commit:* {{ truncate build.commit 8 }}
20+
👤 *Author:* {{ build.author }}
21+
22+
🔗 *Links:*
23+
• <{{ build.link }}|View Build>
24+
# Failure message template
25+
- &failure_message >
26+
❌ *FAILED* - Latest Build #{{ build.number }}
27+
28+
📁 *Repository:* {{ repo.name }}
29+
🌿 *Branch:* {{ build.branch }}
30+
📝 *Commit:* {{ truncate build.commit 8 }}
31+
👤 *Author:* {{ build.author }}
32+
33+
🔗 *Links:*
34+
• <{{ build.link }}|View Build>
35+
36+
steps:
37+
# Security check - scan for secrets/credentials
38+
- name: run-pre-commit-hooks
39+
image: registry.cloud.josa.ngo/library/pre-commit-runner
40+
settings:
41+
args: "--all-files"
42+
skip: "end-of-file-fixer, yamllint, trailing-whitespace"
43+
44+
# Build latest image (development and other branches)
45+
- name: build-latest-image
46+
image: woodpeckerci/plugin-docker-buildx
47+
settings:
48+
repo: *docker_repo
49+
registry: *registry_url
50+
dockerfile: ./Dockerfile
51+
tags:
52+
- ${CI_COMMIT_SHA:-latest}
53+
- latest
54+
username:
55+
from_secret: REGISTRY_USERNAME
56+
password:
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+
69+
depends_on:
70+
- run-pre-commit-hooks
71+
72+
# Slack notification for latest build success
73+
- name: notify-slack-latest-success
74+
image: plugins/slack
75+
settings:
76+
webhook:
77+
from_secret: SLACK_WEBHOOK
78+
channel: *slack_channel
79+
template: *success_message
80+
when:
81+
- status: success
82+
depends_on:
83+
- run-pre-commit-hooks
84+
- build-latest-image
85+
86+
# Slack notification for latest build failure
87+
- name: notify-slack-latest-failure
88+
image: plugins/slack
89+
settings:
90+
webhook:
91+
from_secret: SLACK_WEBHOOK
92+
channel: *slack_channel
93+
template: *failure_message
94+
when:
95+
- status: failure
96+
depends_on:
97+
- run-pre-commit-hooks
98+
- build-latest-image
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
when:
2+
- event: [push, manual]
3+
branch: [main]
4+
- event: [pull_request]
5+
# Only run when PR targets main branch
6+
evaluate: 'CI_COMMIT_TARGET_BRANCH == "main"'
7+
# Build the source branch (not main)
8+
branch:
9+
exclude: [main]
10+
11+
variables:
12+
- &registry_url "https://registry.cloud.josa.ngo"
13+
- &docker_repo "registry.cloud.josa.ngo/library/kutt"
14+
- &slack_channel "builds"
15+
# Success message template
16+
- &success_message >
17+
✅ *SUCCESS* - Stable Build #{{ build.number }}
18+
19+
📁 *Repository:* {{ repo.name }}
20+
🌿 *Branch:* {{ build.branch }}
21+
📝 *Commit:* {{ truncate build.commit 8 }}
22+
👤 *Author:* {{ build.author }}
23+
24+
🔗 *Links:*
25+
• <{{ build.link }}|View Build>
26+
# Failure message template
27+
- &failure_message >
28+
❌ *FAILED* - Stable Build #{{ build.number }}
29+
30+
📁 *Repository:* {{ repo.name }}
31+
🌿 *Branch:* {{ build.branch }}
32+
📝 *Commit:* {{ truncate build.commit 8 }}
33+
👤 *Author:* {{ build.author }}
34+
35+
🔗 *Links:*
36+
• <{{ build.link }}|View Build>
37+
38+
steps:
39+
- name: run-pre-commit-hooks
40+
image: registry.cloud.josa.ngo/library/pre-commit-runner
41+
settings:
42+
args: "--all-files"
43+
skip: "end-of-file-fixer, yamllint, trailing-whitespace"
44+
45+
# Build stable image (main branch only)
46+
- name: build-stable-image
47+
image: woodpeckerci/plugin-docker-buildx
48+
settings:
49+
repo: *docker_repo
50+
registry: *registry_url
51+
dockerfile: ./Dockerfile
52+
tags:
53+
- ${CI_COMMIT_SHA:-latest}
54+
- stable
55+
username:
56+
from_secret: REGISTRY_USERNAME
57+
password:
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+
70+
depends_on:
71+
- run-pre-commit-hooks
72+
73+
# Slack notification for stable build success
74+
- name: notify-slack-stable-success
75+
image: plugins/slack
76+
settings:
77+
webhook:
78+
from_secret: SLACK_WEBHOOK
79+
channel: *slack_channel
80+
template: *success_message
81+
when:
82+
- status: success
83+
depends_on:
84+
- run-pre-commit-hooks
85+
- build-stable-image
86+
87+
# Slack notification for stable build failure
88+
- name: notify-slack-stable-failure
89+
image: plugins/slack
90+
settings:
91+
webhook:
92+
from_secret: SLACK_WEBHOOK
93+
channel: *slack_channel
94+
template: *failure_message
95+
when:
96+
- status: failure
97+
depends_on:
98+
- run-pre-commit-hooks
99+
- build-stable-image

0 commit comments

Comments
 (0)