diff --git a/.tekton/operator-index-ocp-v4-12-build.yaml b/.tekton/operator-index-ocp-v4-12-build.yaml index f8507e9f..86aed7b8 100644 --- a/.tekton/operator-index-ocp-v4-12-build.yaml +++ b/.tekton/operator-index-ocp-v4-12-build.yaml @@ -45,6 +45,9 @@ spec: - name: git-auth secret: secretName: '{{ git_auth_secret }}' + - name: github-auth + secret: + secretName: rhacs-github-bot-token pipelineRef: name: operator-index-pipeline diff --git a/.tekton/operator-index-ocp-v4-13-build.yaml b/.tekton/operator-index-ocp-v4-13-build.yaml index 2cb0ab40..1564318b 100644 --- a/.tekton/operator-index-ocp-v4-13-build.yaml +++ b/.tekton/operator-index-ocp-v4-13-build.yaml @@ -44,6 +44,9 @@ spec: - name: git-auth secret: secretName: '{{ git_auth_secret }}' + - name: github-auth + secret: + secretName: rhacs-github-bot-token pipelineRef: name: operator-index-pipeline diff --git a/.tekton/operator-index-ocp-v4-14-build.yaml b/.tekton/operator-index-ocp-v4-14-build.yaml index e669f805..85550de7 100644 --- a/.tekton/operator-index-ocp-v4-14-build.yaml +++ b/.tekton/operator-index-ocp-v4-14-build.yaml @@ -40,6 +40,9 @@ spec: - name: git-auth secret: secretName: '{{ git_auth_secret }}' + - name: github-auth + secret: + secretName: rhacs-github-bot-token pipelineRef: name: operator-index-pipeline diff --git a/.tekton/operator-index-ocp-v4-15-build.yaml b/.tekton/operator-index-ocp-v4-15-build.yaml index 35d741c5..48c3590d 100644 --- a/.tekton/operator-index-ocp-v4-15-build.yaml +++ b/.tekton/operator-index-ocp-v4-15-build.yaml @@ -40,6 +40,9 @@ spec: - name: git-auth secret: secretName: '{{ git_auth_secret }}' + - name: github-auth + secret: + secretName: rhacs-github-bot-token pipelineRef: name: operator-index-pipeline diff --git a/.tekton/operator-index-ocp-v4-16-build.yaml b/.tekton/operator-index-ocp-v4-16-build.yaml index fb909b68..5b575e6b 100644 --- a/.tekton/operator-index-ocp-v4-16-build.yaml +++ b/.tekton/operator-index-ocp-v4-16-build.yaml @@ -40,6 +40,9 @@ spec: - name: git-auth secret: secretName: '{{ git_auth_secret }}' + - name: github-auth + secret: + secretName: rhacs-github-bot-token pipelineRef: name: operator-index-pipeline diff --git a/.tekton/operator-index-ocp-v4-17-build.yaml b/.tekton/operator-index-ocp-v4-17-build.yaml index 0e466acb..95144e2c 100644 --- a/.tekton/operator-index-ocp-v4-17-build.yaml +++ b/.tekton/operator-index-ocp-v4-17-build.yaml @@ -40,6 +40,9 @@ spec: - name: git-auth secret: secretName: '{{ git_auth_secret }}' + - name: github-auth + secret: + secretName: rhacs-github-bot-token pipelineRef: name: operator-index-pipeline diff --git a/.tekton/operator-index-ocp-v4-18-build.yaml b/.tekton/operator-index-ocp-v4-18-build.yaml index 92d099d3..3e86bb26 100644 --- a/.tekton/operator-index-ocp-v4-18-build.yaml +++ b/.tekton/operator-index-ocp-v4-18-build.yaml @@ -40,6 +40,9 @@ spec: - name: git-auth secret: secretName: '{{ git_auth_secret }}' + - name: github-auth + secret: + secretName: rhacs-github-bot-token pipelineRef: name: operator-index-pipeline diff --git a/.tekton/operator-index-ocp-v4-19-build.yaml b/.tekton/operator-index-ocp-v4-19-build.yaml index 164be7b3..17089c36 100644 --- a/.tekton/operator-index-ocp-v4-19-build.yaml +++ b/.tekton/operator-index-ocp-v4-19-build.yaml @@ -40,6 +40,9 @@ spec: - name: git-auth secret: secretName: '{{ git_auth_secret }}' + - name: github-auth + secret: + secretName: rhacs-github-bot-token pipelineRef: name: operator-index-pipeline diff --git a/.tekton/operator-index-pipeline.yaml b/.tekton/operator-index-pipeline.yaml index e93e13b7..52fbac37 100644 --- a/.tekton/operator-index-pipeline.yaml +++ b/.tekton/operator-index-pipeline.yaml @@ -164,6 +164,7 @@ spec: value: $(tasks.clone-repository.results.commit) workspaces: - name: git-auth + - name: github-auth tasks: - name: post-metric-start taskRef: *post-bigquery-metrics-ref @@ -280,7 +281,28 @@ spec: when: - input: $(tasks.init.results.build) operator: in - values: ["true"] + values: [ "true" ] + + - name: post-pr-comment-fbc-build + params: + - name: REPO + value: stackrox/operator-index + - name: PR_NUMBER + value: $(context.pipelineRun.annotations['build.appstudio.redhat.com/pull_request_number']) + - name: IMAGE_URL + value: $(tasks.build-image-index.results.IMAGE_URL) + workspaces: + - name: basic-auth + workspace: git-auth + - name: github-auth + workspace: github-auth + taskRef: + name: post-pr-comment-fbc-build + when: + - input: $(params.skip-checks) + operator: in + values: [ "false" ] + - name: deprecated-base-image-check params: - name: IMAGE_URL diff --git a/.tekton/post-pr-comment-fbc-build.yaml b/.tekton/post-pr-comment-fbc-build.yaml new file mode 100644 index 00000000..eaea8b2b --- /dev/null +++ b/.tekton/post-pr-comment-fbc-build.yaml @@ -0,0 +1,42 @@ +apiVersion: tekton.dev/v1 +kind: Task +metadata: + name: post-pr-comment-fbc-build +spec: + params: + - name: REPO + type: string + description: GitHub repo in 'owner/repo' format + - name: PR_NUMBER + type: string + description: PR number to post to + - name: IMAGE_URL + type: string + description: FBC build image URL to post as a comment + workspaces: + - name: github-auth + description: Workspace with the GitHub token secret + steps: + - name: show-fbc-build-images + image: registry.redhat.io/rhel9/python-311@sha256:47e23afaf5daf6a98e76a3b5a924b85bbcb19c72b5c6ac474a418aea54cd8aae + env: + - name: GITHUB_TOKEN + value: "$(params.github_token)" + script: | + #!/usr/bin/env python3 + import os + import requests + + pr_number = os.environ["PR_NUMBER"] + image_url = os.environ["IMAGE_URL"] + token = os.environ["GITHUB_TOKEN"] + + url = f"https://api.github.com/repos/stackrox/operator-index/issues/{pr_number}/comments" + headers = { + "Authorization": f"token {token}", + "Accept": "application/vnd.github.v3+json" + } + data = {"body": f"Build image URL: {image_url}"} + resp = requests.post(url, headers=headers, json=data) + print("Status:", resp.status_code) + print("Response:", resp.text) diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..1b76004a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "cSpell.words": [ + "goccy", + "mediatype", + "rhacs" + ] +} \ No newline at end of file