Skip to content

Commit 7d69ad8

Browse files
committed
use pull_request_number for generatign preview urls
Fixes 555 Signed-off-by: Chmouel Boudjnah <[email protected]>
1 parent f057ac4 commit 7d69ad8

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

.tekton/pull-request.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,8 @@ spec:
4848
git diff --name-only FETCH_HEAD | grep -q '^docs/' || exit 0
4949
cd docs
5050
sed -i '1acanonifyURLs = true' config.toml
51-
# TODO: use a params and {{ pull_request_number }} so we get url
52-
# by pull_request_number instead of revision
53-
hugo --gc --minify -d {{ revision }} -b https://preview-pipelines-as-code-ci.apps.paac.devcluster.openshift.com/docs/{{ revision }}
54-
echo "Preview URL: https://preview-pipelines-as-code-ci.apps.paac.devcluster.openshift.com/docs/{{ revision }}"
51+
hugo --gc --minify -d {{ pull_request_number }} -b https://preview-pipelines-as-code-ci.apps.paac.devcluster.openshift.com/docs/{{ pull_request_number }}
52+
echo "Preview URL: https://preview-pipelines-as-code-ci.apps.paac.devcluster.openshift.com/docs/{{ pull_request_number }}"
5553
- name: upload-to-static-server
5654
# it has curl and we already pulled it
5755
image: registry.redhat.io/rhel8/go-toolset:1.16.12-7
@@ -69,11 +67,11 @@ spec:
6967
key: "credentials"
7068
script: |
7169
cd docs
72-
[[ -d {{ revision }} ]] || exit 0
73-
tar czf - {{ revision }} | curl -u ${UPLOADER_UPLOAD_CREDENTIALS} -F path=docs -F targz=true -X POST -F file=@- http://uploader:8080/upload
70+
[[ -d {{ pull_request_number }} ]] || exit 0
71+
tar czf - {{ pull_request_number }} | curl -u ${UPLOADER_UPLOAD_CREDENTIALS} -F path=docs -F targz=true -X POST -F file=@- http://uploader:8080/upload
7472
# Post as status
7573
set +x
76-
curl -H "Authorization: Bearer ${HUB_TOKEN}" -H 'Accept: application/vnd.github.v3+json' -X POST https://api.github.com/repos/{{repo_owner}}/{{repo_name}}/statuses/{{revision}} -d '{"state": "success", "target_url": "https://preview-pipelines-as-code-ci.apps.paac.devcluster.openshift.com/docs/{{ revision }}", "description": "Generated with brio.", "context": "Pipelines as Code Preview URL"}'
74+
curl -H "Authorization: Bearer ${HUB_TOKEN}" -H 'Accept: application/vnd.github.v3+json' -X POST https://api.github.com/repos/{{repo_owner}}/{{repo_name}}/statuses/{{revision}} -d '{"state": "success", "target_url": "https://preview-pipelines-as-code-ci.apps.paac.devcluster.openshift.com/docs/{{ pull_request_number }}", "description": "Generated with brio.", "context": "Pipelines as Code Preview URL"}'
7775
7876
workspaces:
7977
- name: source

0 commit comments

Comments
 (0)