Skip to content

Commit 1993649

Browse files
init commit / changing tags
1 parent 21b5ad8 commit 1993649

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

.tekton/ansible-ai-connect-operator-pull-request.yaml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,27 @@ spec:
183183
workspace: workspace
184184
- name: basic-auth
185185
workspace: git-auth
186+
187+
- name: git-metadata
188+
runAfter:
189+
- clone-repository
190+
workspaces:
191+
- name: source
192+
workspace: workspace
193+
taskSpec:
194+
workspaces:
195+
- name: source
196+
steps:
197+
- name: get-commit-timestamp
198+
image: alpine/git
199+
script: |
200+
#!/bin/sh
201+
set -euo pipefail
202+
cd "$(workspaces.source.path)/source"
203+
echo -n $(date -d @$(git log -1 --format=%at) "+%Y%m%d%H%M") > $(results.commit-timestamp.path)
204+
results:
205+
- name: commit-timestamp
206+
186207
- name: prefetch-dependencies
187208
params:
188209
- name: input
@@ -225,8 +246,7 @@ spec:
225246
- name: COMMIT_SHA
226247
value: $(tasks.clone-repository.results.commit)
227248
- name: BUILD_ARGS
228-
value:
229-
- $(params.build-args[*])
249+
value: ["IMAGE_TAGS=pr-{{pull_request_number}} pr-{{pull_request_number}}.$(tasks.git-metadata.results.commit-timestamp)", "GIT_COMMIT=$(tasks.clone-repository.results.commit)"]
230250
- name: BUILD_ARGS_FILE
231251
value: $(params.build-args-file)
232252
runAfter:
@@ -411,6 +431,8 @@ spec:
411431
params:
412432
- name: IMAGE
413433
value: $(tasks.build-container.results.IMAGE_URL)
434+
- name: ADDITIONAL_TAGS
435+
value: ["pr-{{pull_request_number}}", "pr-{{pull_request_number}}.$(tasks.git-metadata.results.commit-timestamp)"]
414436
runAfter:
415437
- build-container
416438
taskRef:

.tekton/ansible-ai-connect-operator-push.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,26 @@ spec:
180180
workspace: workspace
181181
- name: basic-auth
182182
workspace: git-auth
183+
- name: git-metadata
184+
runAfter:
185+
- clone-repository
186+
workspaces:
187+
- name: source
188+
workspace: workspace
189+
taskSpec:
190+
workspaces:
191+
- name: source
192+
steps:
193+
- name: get-commit-timestamp
194+
image: alpine/git
195+
script: |
196+
#!/bin/sh
197+
set -euo pipefail
198+
cd "$(workspaces.source.path)/source"
199+
echo -n $(date -d @$(git log -1 --format=%at) "+%Y%m%d%H%M") > $(results.commit-timestamp.path)
200+
results:
201+
- name: commit-timestamp
202+
183203
- name: prefetch-dependencies
184204
params:
185205
- name: input
@@ -222,8 +242,7 @@ spec:
222242
- name: COMMIT_SHA
223243
value: $(tasks.clone-repository.results.commit)
224244
- name: BUILD_ARGS
225-
value:
226-
- $(params.build-args[*])
245+
value: ["IMAGE_TAGS=latest 1.0.$(tasks.git-metadata.results.commit-timestamp)", "GIT_COMMIT=$(tasks.clone-repository.results.commit)"]
227246
- name: BUILD_ARGS_FILE
228247
value: $(params.build-args-file)
229248
runAfter:
@@ -408,6 +427,8 @@ spec:
408427
params:
409428
- name: IMAGE
410429
value: $(tasks.build-container.results.IMAGE_URL)
430+
- name: ADDITIONAL_TAGS
431+
value: ["latest", "1.0.$(tasks.git-metadata.results.commit-timestamp)"]
411432
runAfter:
412433
- build-container
413434
taskRef:

0 commit comments

Comments
 (0)