Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .tekton/operator-index-ocp-v4-19-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 20 additions & 1 deletion .tekton/operator-index-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,26 @@ 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: github-auth
workspace: git-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
Expand Down
42 changes: 42 additions & 0 deletions .tekton/post-pr-comment-fbc-build.yaml
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"cSpell.words": [
"goccy",
"mediatype",
"rhacs"
]
}