Skip to content

Commit 6dc2bd1

Browse files
committed
feat: add ACM fast-forwarding periodic
Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com>
1 parent 63cc142 commit 6dc2bd1

10 files changed

Lines changed: 239 additions & 0 deletions
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
private: true
2+
expose: true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
approvers:
2+
- dhaiducek
3+
- gparvin
4+
5+
reviewers:
6+
- dhaiducek
7+
- gparvin
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
build_root:
2+
image_stream_tag:
3+
name: builder
4+
namespace: stolostron
5+
tag: go1.25-linux
6+
resources:
7+
'*':
8+
requests:
9+
cpu: 100m
10+
memory: 100Mi
11+
tests:
12+
- as: fast-forward
13+
interval: 2h
14+
steps:
15+
env:
16+
DESTINATION_VERSIONS: 2.17 5.0
17+
REPO_MAP_PATH: product/component-registry.yaml
18+
workflow: ocm-ci-fastforward-multiple
19+
zz_generated_metadata:
20+
branch: main
21+
org: stolostron
22+
repo: acm-config
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
periodics:
2+
- agent: kubernetes
3+
cluster: build01
4+
decorate: true
5+
decoration_config:
6+
skip_cloning: true
7+
extra_refs:
8+
- base_ref: main
9+
org: stolostron
10+
repo: acm-config
11+
interval: 2h
12+
labels:
13+
ci.openshift.io/generator: prowgen
14+
pj-rehearse.openshift.io/can-be-rehearsed: "true"
15+
name: periodic-ci-stolostron-acm-config-main-fast-forward
16+
spec:
17+
containers:
18+
- args:
19+
- --gcs-upload-secret=/secrets/gcs/service-account.json
20+
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
21+
- --lease-server-credentials-file=/etc/boskos/credentials
22+
- --oauth-token-path=/usr/local/github-credentials/oauth
23+
- --report-credentials-file=/etc/report/credentials
24+
- --target=fast-forward
25+
command:
26+
- ci-operator
27+
env:
28+
- name: HTTP_SERVER_IP
29+
valueFrom:
30+
fieldRef:
31+
fieldPath: status.podIP
32+
image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest
33+
imagePullPolicy: Always
34+
name: ""
35+
ports:
36+
- containerPort: 8080
37+
name: http
38+
resources:
39+
requests:
40+
cpu: 10m
41+
volumeMounts:
42+
- mountPath: /etc/boskos
43+
name: boskos
44+
readOnly: true
45+
- mountPath: /secrets/gcs
46+
name: gcs-credentials
47+
readOnly: true
48+
- mountPath: /usr/local/github-credentials
49+
name: github-credentials-openshift-ci-robot-private-git-cloner
50+
readOnly: true
51+
- mountPath: /secrets/manifest-tool
52+
name: manifest-tool-local-pusher
53+
readOnly: true
54+
- mountPath: /etc/pull-secret
55+
name: pull-secret
56+
readOnly: true
57+
- mountPath: /etc/report
58+
name: result-aggregator
59+
readOnly: true
60+
serviceAccountName: ci-operator
61+
volumes:
62+
- name: boskos
63+
secret:
64+
items:
65+
- key: credentials
66+
path: credentials
67+
secretName: boskos-credentials
68+
- name: github-credentials-openshift-ci-robot-private-git-cloner
69+
secret:
70+
secretName: github-credentials-openshift-ci-robot-private-git-cloner
71+
- name: manifest-tool-local-pusher
72+
secret:
73+
secretName: manifest-tool-local-pusher
74+
- name: pull-secret
75+
secret:
76+
secretName: registry-pull-credentials
77+
- name: result-aggregator
78+
secret:
79+
secretName: result-aggregator
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../OWNERS
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
3+
exit_code=0
4+
5+
echo "Fast-forward workflow inputs:
6+
* REPO_MAP_PATH: ${REPO_MAP_PATH}
7+
* DESTINATION_VERSIONS: ${DESTINATION_VERSIONS}
8+
"
9+
10+
if [[ ! -f "${REPO_MAP_PATH}" ]]; then
11+
echo "ERROR: REPO_MAP_PATH '${REPO_MAP_PATH}' not found"
12+
exit 1
13+
fi
14+
15+
if [[ -z "${DESTINATION_VERSIONS}" ]]; then
16+
echo "ERROR: DESTINATION_VERSIONS may not be empty"
17+
exit 1
18+
fi
19+
20+
for version in ${DESTINATION_VERSIONS}; do
21+
if [[ ! "${version}" =~ ^[0-9]+\.[0-9]+$ ]]; then
22+
echo "ERROR: Version '$version' is not in X.Y format"
23+
exit 1
24+
fi
25+
done
26+
27+
for product in mce acm; do
28+
component_repos=$(yq '.components[] |
29+
select(.bundle == "'"${product}-operator-bundle"'" and
30+
.repository == "https://github.com/stolostron/*").repository' "${REPO_MAP_PATH}")
31+
for repo in ${component_repos}; do
32+
owner_repo=${repo#https://github.com/}
33+
# owner=${owner_repo%/*}
34+
repo=${owner_repo#*/}
35+
36+
echo "INFO: Handling ${owner_repo}"
37+
38+
branch_prefix="release"
39+
if [[ ${product} == "mce" ]]; then
40+
branch_prefix="backplane"
41+
fi
42+
43+
for version in ${DESTINATION_VERSIONS}; do
44+
branch="${branch_prefix}-${version}"
45+
echo "INFO: Fast-forwarding ${owner_repo} main to branch: ${branch}"
46+
# log_file="${ARTIFACT_DIR}/fastforward-${owner_repo}-${branch}.log"
47+
# REPO_OWNER=${owner} \
48+
# REPO_NAME=${repo} \
49+
# SOURCE_BRANCH=main \
50+
# DESTINATION_BRANCH=${branch} \
51+
# ../fastforward/ocm-ci-fastforward-commands.sh >"${log_file}" 2>&1 ||
52+
# {
53+
# exit_code=$?
54+
# echo "ERROR: Failed to fast-forward ${owner_repo} to branch: ${branch}"
55+
# echo "Logs:"
56+
# sed 's/^/ /' "${log_file}"
57+
# }
58+
done
59+
done
60+
done
61+
62+
exit ${exit_code}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"path": "ocm/ci/fastforward-multiple/ocm-ci-fastforward-multiple-ref.yaml",
3+
"owners": {
4+
"approvers": [
5+
"mark-nc",
6+
"MacdonEm",
7+
"smithbw88",
8+
"eemurphy"
9+
]
10+
}
11+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
ref:
2+
as: ocm-ci-fastforward-multiple
3+
from: src
4+
commands: ocm-ci-fastforward-multiple-commands.sh
5+
resources:
6+
requests:
7+
cpu: 100m
8+
memory: 100Mi
9+
credentials:
10+
- namespace: test-credentials
11+
name: acm-cicd-github
12+
mount_path: /etc/acm-cicd-github
13+
env:
14+
- name: GITHUB_USER
15+
default: "acm-cicd-prow-bot"
16+
documentation: |-
17+
The GitHub user name.
18+
- name: GITHUB_TOKEN_FILE
19+
default: "/etc/acm-cicd-github/token"
20+
documentation: |-
21+
The file that stores the GitHub token. Should match credentials stanza
22+
mount path.
23+
- name: REPO_MAP_PATH
24+
default: ""
25+
documentation: |-
26+
Path to a YAML file containing a component mapping for fast-forwarding as:
27+
.components[{
28+
bundle: <product>-operator-bundle,
29+
repository: https://github.com/<owner>/<repo>
30+
}]
31+
- name: DESTINATION_VERSIONS
32+
default: ""
33+
documentation: |-
34+
The version(s) that you want to fast forward TO.
35+
documentation: |-
36+
This step fast forwards a source branch to a destination branch in a GitHub
37+
repo.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"path": "ocm/ci/fastforward-multiple/ocm-ci-fastforward-multiple-workflow.yaml",
3+
"owners": {
4+
"approvers": [
5+
"mark-nc",
6+
"MacdonEm",
7+
"smithbw88",
8+
"eemurphy"
9+
]
10+
}
11+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
workflow:
2+
as: ocm-ci-fastforward-multiple
3+
steps:
4+
test:
5+
- ref: ocm-ci-fastforward-multiple
6+
documentation: |-
7+
This workflow calls the fastforward workflow for multiple repositories.

0 commit comments

Comments
 (0)