Skip to content

Commit 8040da0

Browse files
author
Shivam Mukhade
authored
Merge pull request #562 from chmouel/issue-555-generate-previw-url-by-pr-number-instead-of-revision
use pull_request_number for generating preview urls
2 parents f057ac4 + 6d51637 commit 8040da0

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
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

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ Full documentation is available from <https://pipelinesascode.com>
99
## Introduction
1010

1111
Pipelines as Code let you use
12-
the [Pipelines as Code flow]([https://www.thoughtworks.com/radar/techniques/pipelines-as-code](https://www.thoughtworks.com/radar/techniques/pipelines-as-code))
13-
directly with OpenShift Pipelines.
12+
the [Pipelines as Code flow]([https://www.thoughtworks.com/radar/techniques/pipelines-as-code](https://www.thoughtworks.com/radar/techniques/pipelines-as-code)) directly with Tekton and OpenShift Pipelines.
1413

1514
The goal of Pipelines as Code is to let you define your
1615
[Tekton](https://tekton.cd) templates inside your source code repository and have the pipeline run and report the status

docs/content/docs/guide/cli.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,9 @@ You can override the URL with the flag `--route-url`.
9898

9999
### bootstrap github-app
100100

101-
If you only want to create the GitHub application you can use `tkn pac bootstrap
102-
github-app` directly which would skip the installation and only create the
101+
If you only want to create a GitHub application to use with Pipelines as Code
102+
and not the full `bootstrap` excercise, you can use `tkn pac bootstrap
103+
github-app` directly which will skip the installation and only create the
103104
GitHub application and the secret with all the information needed in the
104105
`pipelines-as-code` namespace.
105106

0 commit comments

Comments
 (0)