Skip to content

Commit 1a34099

Browse files
authored
Merge branch 'main' into shumathu-KONFLUX-5929
2 parents 8fb3fee + a8212d3 commit 1a34099

File tree

1,210 files changed

+108190
-14547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,210 files changed

+108190
-14547
lines changed

.github/pull_request_template.md

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
## 📝 Description of the Change
22

3-
<!--- Take all comments into account and provide a detailed description of the change. -->
3+
## 👨🏻‍ Linked Jira
4+
5+
<!-- <https://issues.redhat.com/browse/SRVKP-> -->
46

57
## 🔗 Linked GitHub Issue
68

79
Fixes #
810

9-
## 👨🏻‍ Linked Jira
10-
1111
<!-- This is optional, but if you have a Jira ticket related to this PR, please link it here. -->
1212
## 🚀 Type of Change
1313

14+
<!-- (update the title of the Pull Request accordingly), the lint task checks it -->
15+
1416
- [ ] 🐛 Bug fix (`fix:`)
1517
- [ ] ✨ New feature (`feat:`)
1618
- [ ] 💥 Breaking change (`feat!:`, `fix!:`)
@@ -20,8 +22,6 @@ Fixes #
2022
- [ ] 🔧 Enhancement (`enhance:`)
2123
- [ ] 📦 Dependency update (`deps:`)
2224

23-
<!-- (update the title of the Pull Request accordingly) -->
24-
2525
## 🧪 Testing Strategy
2626

2727
- [ ] Unit tests
@@ -30,6 +30,44 @@ Fixes #
3030
- [ ] Manual testing
3131
- [ ] Not Applicable
3232

33+
## 🤖 AI Assistance
34+
35+
- [ ] I have not used any AI assistance for this PR.
36+
- [ ] I have used AI assistance for this PR.
37+
38+
If you have used AI assistance, please provide the following details:
39+
40+
**Which LLM was used?**
41+
42+
- [ ] GitHub Copilot
43+
- [ ] ChatGPT (OpenAI)
44+
- [ ] Claude (Anthropic)
45+
- [ ] Cursor
46+
- [ ] Gemini (Google)
47+
- [ ] Other: ____________
48+
49+
**Extent of AI Assistance:**
50+
51+
- [ ] Documentation and research only
52+
- [ ] Unit tests or E2E tests only
53+
- [ ] Code generation (parts of the code)
54+
- [ ] Full code generation (most of the PR)
55+
- [ ] PR description and comments
56+
- [ ] Commit message(s)
57+
58+
> [!IMPORTANT]
59+
> If the majority of the code in this PR was generated by an AI, please add a `Co-authored-by` trailer to your commit message.
60+
> For example:
61+
>
62+
> Co-authored-by: Gemini <[email protected]>
63+
> Co-authored-by: ChatGPT <[email protected]>
64+
> Co-authored-by: Claude <[email protected]>
65+
> Co-authored-by: Cursor <[email protected]>
66+
> Co-authored-by: Copilot <[email protected]>
67+
>
68+
> **💡You can use the script `./hack/add-llm-coauthor.sh` to automatically add
69+
> these co-author trailers to your commits.
70+
3371
## ✅ Submitter Checklist
3472

3573
- [ ] 📝 My commit messages are clear, informative, and follow the project's [How to write a git commit message guide](https://developers.google.com/blockly/guides/contribute/get-started/commits). **The [Gitlint](https://jorisroovers.com/gitlint/latest) linter ensures in CI it's properly validated**

.github/workflows/e2e.yaml

Lines changed: 155 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
provider: [providers, gitea_others]
4444

4545
env:
46+
TARGET_TEAM_SLUGS: "pipeline-as-code,pipeline-as-code-contributors"
4647
KO_DOCKER_REPO: localhost:5000
4748
CONTROLLER_DOMAIN_URL: controller.paac-127-0-0-1.nip.io
4849
TEST_GITHUB_REPO_OWNER_GITHUBAPP: openshift-pipelines/pipelines-as-code-e2e-tests
@@ -79,35 +80,164 @@ jobs:
7980
uses: actions/github-script@v8
8081
with:
8182
script: |
82-
const actor = context.payload.pull_request.user.login;
83-
const org = context.repo.owner;
84-
85-
// Allow a specific list of trusted bots to bypass the permission check.
86-
const trustedBots = ['dependabot[bot]']; // Add any other trusted bot accounts here
87-
if (trustedBots.includes(actor)) {
88-
core.info(`User @${actor} is a trusted bot, allowing.`);
83+
if (!context || !context.payload || !context.payload.pull_request) {
84+
core.setFailed('Invalid GitHub context: missing required pull_request information');
8985
return;
9086
}
9187
92-
try {
93-
// Directly check the user's permission level on the repository.
94-
// This covers both org members and external collaborators with sufficient access.
95-
const response = await github.rest.repos.getCollaboratorPermissionLevel({
96-
owner: org,
97-
repo: context.repo.repo,
98-
username: actor,
99-
});
100-
101-
const permission = response.data.permission;
102-
if (permission !== 'admin' && permission !== 'write') {
103-
core.setFailed(`❌ User @${actor} has only '${permission}' repository permission. 'write' or 'admin' is required.`);
104-
} else {
105-
core.info(`✅ User @${actor} has '${permission}' repository permission. Proceeding.`);
88+
async function run() {
89+
const actor = context.payload.pull_request.user.login;
90+
const repoOwner = context.repo.owner;
91+
const repoName = context.repo.repo;
92+
const targetOrg = context.repo.owner;
93+
94+
core.info(`🔍 Starting permission check for user: @${actor}`);
95+
core.info(`📋 Repository: ${repoOwner}/${repoName}`);
96+
core.info(`🏢 Target organization: ${targetOrg}`);
97+
98+
// Condition 1: Check if the user is a trusted bot.
99+
const trustedBots = ["dependabot[bot]", "renovate[bot]"];
100+
core.info(`🤖 Checking if @${actor} is a trusted bot...`);
101+
core.info(` Trusted bots list: ${trustedBots.join(', ')}`);
102+
103+
if (trustedBots.includes(actor)) {
104+
core.info(`✅ Condition met: User @${actor} is a trusted bot. Proceeding.`);
105+
return; // Success
106+
}
107+
core.info(` ❌ User @${actor} is not a trusted bot.`);
108+
109+
// Condition 2: Check for public membership in the target organization.
110+
core.info(`\n👥 Condition 2: Checking organization and team membership...`);
111+
core.info(
112+
`User @${actor} is not a trusted bot. Checking for membership in '${targetOrg}'...`,
113+
);
114+
try {
115+
// Optional: check membership in one or more org teams (set TARGET_TEAM_SLUGS as comma-separated slugs in workflow env)
116+
const teamSlugsEnv = process.env.TARGET_TEAM_SLUGS || "";
117+
const teamSlugs = teamSlugsEnv
118+
.split(",")
119+
.map((s) => s.trim())
120+
.filter(Boolean);
121+
122+
core.info(`🔧 TARGET_TEAM_SLUGS environment variable: "${teamSlugsEnv}"`);
123+
core.info(`📝 Parsed team slugs: [${teamSlugs.join(', ')}]`);
124+
125+
if (teamSlugs.length > 0) {
126+
core.info(`🔍 Checking team membership for ${teamSlugs.length} team(s)...`);
127+
for (const team_slug of teamSlugs) {
128+
core.info(` Checking team: ${team_slug}...`);
129+
try {
130+
const membership = await github.rest.teams.getMembershipForUserInOrg({
131+
org: targetOrg,
132+
team_slug,
133+
username: actor,
134+
});
135+
core.info(` API response for team '${team_slug}': ${JSON.stringify(membership.data)}`);
136+
if (
137+
membership &&
138+
membership.data &&
139+
membership.data.state === "active"
140+
) {
141+
core.info(
142+
`✅ Condition met: User @${actor} is a member of team '${team_slug}' in '${targetOrg}'. Proceeding.`,
143+
);
144+
return; // Success
145+
} else {
146+
core.info(` ⚠️ Team membership found but state is not 'active': ${membership.data.state}`);
147+
}
148+
} catch (err) {
149+
// Not a member of this team or team doesn't exist — continue to next
150+
core.info(
151+
` ❌ User @${actor} is not a member of team '${team_slug}' (or team not found). Error: ${err.message}`,
152+
);
153+
}
154+
}
155+
// If we tried team checks and none matched, continue to next org membership checks
156+
core.info(
157+
`ⓘ User @${actor} is not a member of any configured teams in '${targetOrg}'. Falling back to org membership checks.`,
158+
);
159+
} else {
160+
core.info(`ℹ️ No teams configured in TARGET_TEAM_SLUGS. Skipping team membership checks.`);
161+
}
162+
core.info(`🏢 Checking organization membership for @${actor} in '${targetOrg}'...`);
163+
try {
164+
core.info(` Attempting checkMembershipForUser API call...`);
165+
await github.rest.orgs.checkMembershipForUser({
166+
org: targetOrg,
167+
username: actor,
168+
});
169+
core.info(
170+
`✅ Condition met: User @${actor} is a member of '${targetOrg}'. Proceeding.`,
171+
);
172+
return; // Success
173+
} catch (err) {
174+
// Try public membership as fallback
175+
core.info(` ❌ Private membership check failed: ${err.message}`);
176+
core.info(` Attempting checkPublicMembershipForUser API call...`);
177+
try {
178+
await github.rest.orgs.checkPublicMembershipForUser({
179+
org: targetOrg,
180+
username: actor,
181+
});
182+
core.info(
183+
`✅ Condition met: User @${actor} is a public member of '${targetOrg}'. Proceeding.`,
184+
);
185+
return; // Success
186+
} catch (publicErr) {
187+
// Neither private nor public member - will be caught by outer catch
188+
core.info(` ❌ Public membership check failed: ${publicErr.message}`);
189+
throw publicErr;
190+
}
191+
}
192+
} catch (error) {
193+
// This is not a failure, just one unmet condition. Log and continue.
194+
core.info(
195+
`ⓘ User @${actor} is not a public member of '${targetOrg}'. Checking repository permissions as a fallback.`,
196+
);
197+
}
198+
199+
// Condition 3: Check for write/admin permission on the repository.
200+
core.info(`\n🔐 Condition 3: Checking repository collaborator permissions...`);
201+
try {
202+
core.info(` Attempting getCollaboratorPermissionLevel API call...`);
203+
const response = await github.rest.repos.getCollaboratorPermissionLevel({
204+
owner: repoOwner,
205+
repo: repoName,
206+
username: actor,
207+
});
208+
209+
const permission = response.data.permission;
210+
core.info(` User @${actor} has '${permission}' permission on ${repoOwner}/${repoName}`);
211+
212+
if (permission === "admin" || permission === "write") {
213+
core.info(
214+
`✅ Condition met: User @${actor} has '${permission}' repository permission. Proceeding.`,
215+
);
216+
return; // Success
217+
} else {
218+
// If we reach here, no conditions were met. This is the final failure.
219+
core.info(` ❌ Permission '${permission}' is insufficient (requires 'write' or 'admin')`);
220+
core.setFailed(
221+
`❌ Permission check failed. User @${actor} did not meet any required conditions (trusted bot, org member, or repo write access).`,
222+
);
223+
return;
224+
}
225+
} catch (error) {
226+
// This error means they are not even a collaborator.
227+
core.info(` ❌ Collaborator permission check failed: ${error.message}`);
228+
core.setFailed(
229+
`❌ Permission check failed. User @${actor} is not a collaborator on this repository and did not meet other conditions.`,
230+
);
231+
return;
106232
}
107-
} catch (error) {
108-
core.setFailed(`Permission check failed for @${actor}. They are likely not a collaborator on the repository. Error: ${error.message}`);
109233
}
110234
235+
run().catch(err => {
236+
core.error(`💥 Unexpected error during permission check: ${err.message}`);
237+
core.error(` Stack trace: ${err.stack}`);
238+
core.setFailed(`Unexpected error during permission check: ${err.message}`);
239+
});
240+
111241
- uses: actions/setup-go@v6
112242
with:
113243
go-version-file: "go.mod"
@@ -154,6 +284,7 @@ jobs:
154284
TEST_GITHUB_SECOND_SMEE_URL: ${{ secrets.TEST_GITHUB_SECOND_SMEE_URL }}
155285
TEST_GITHUB_SECOND_PRIVATE_KEY: ${{ secrets.TEST_GITHUB_SECOND_PRIVATE_KEY }}
156286
TEST_GITHUB_SECOND_WEBHOOK_SECRET: ${{ secrets.TEST_GITHUB_SECOND_WEBHOOK_SECRET }}
287+
TEST_GITHUB_SECOND_APPLICATION_ID: ${{ vars.TEST_GITHUB_SECOND_APPLICATION_ID }}
157288
run: |
158289
./hack/gh-workflow-ci.sh create_second_github_app_controller_on_ghe
159290
@@ -211,7 +342,7 @@ jobs:
211342
212343
- name: Upload artifacts
213344
if: ${{ always() }}
214-
uses: actions/upload-artifact@v4
345+
uses: actions/upload-artifact@v5
215346
with:
216347
name: logs-e2e-tests-${{ matrix.provider }}
217348
path: /tmp/logs

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ coverage*
2222
# ignore tmp files
2323
tmp/*
2424

25+
# ignroe venv directory
26+
.venv/
27+
2528
# emacs tempfiles
2629
\#*
2730
*~

.golangci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ linters:
5757
- whitespace
5858
- zerologlint
5959
settings:
60+
misspell:
61+
ignore-words:
62+
- cancelled
63+
extra-words:
64+
- typo: "canceled"
65+
correction: "cancelled"
6066
errcheck:
6167
exclude-functions:
6268
- (*github.com/tektoncd/pipeline/vendor/go.uber.org/zap.SugaredLogger).Sync

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ homebrew_casks:
8686
- formula: git
8787
homepage: "https://pipelinesascode.com"
8888
description: tkn-pac - A command line interface for interacting with Pipelines as Code
89-
binary: "tkn-pac"
89+
binaries: ["tkn-pac"]
9090
custom_block: |
9191
zsh_completion = "#{staged_path}/_tkn-pac"
9292
bash_completion = "#{staged_path}/tkn-pac.bash"

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default_install_hook_types: ["pre-push"]
44
exclude: '(^docs/themes/hugo-book|^vendor|.*golden$|^\.vale)'
55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v5.0.0
7+
rev: v6.0.0
88
hooks:
99
- id: check-added-large-files
1010
- id: check-toml

.tekton/doc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ spec:
5858
value: $(workspaces.source.path)
5959

6060
- name: hugo-gen
61-
image: golang:1.23
61+
image: golang:1.24
6262
workingDir: $(workspaces.source.path)
6363
env:
6464
- name: UPLOADER_PUBLIC_URL

.tekton/generate-coverage-release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
- name: workingdir
5858
value: $(workspaces.source.path)
5959
- name: unittest
60-
image: golang:1.23
60+
image: golang:1.24
6161
workingDir: $(workspaces.source.path)
6262
env:
6363
- name: GOCACHE
@@ -70,7 +70,7 @@ spec:
7070
GO_TEST_FLAGS="-v -coverprofile=coverage.txt -covermode=atomic"
7171
- name: codecov
7272
# Has everything we need in there and we already fetched it!
73-
image: golang:1.23
73+
image: golang:1.24
7474
workingDir: $(workspaces.source.path)
7575
env:
7676
- name: CODECOV_TOKEN
@@ -88,7 +88,7 @@ spec:
8888
chmod +x ./codecov
8989
./codecov -C {{revision}} -v
9090
- name: upload-release
91-
image: golang:1.23
91+
image: golang:1.24
9292
workingDir: $(workspaces.source.path)
9393
env:
9494
- name: HUB_TOKEN

.tekton/go.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ spec:
5656
- name: unittest
5757
# we get bumped out when usingh the official image with docker.io
5858
# ratelimit so workaround this.
59-
image: golang:1.23
59+
image: golang:1.24
6060
env:
6161
- name: GOCACHE
6262
value: $(workspaces.source.path)/go-build-cache/cache
@@ -71,7 +71,7 @@ spec:
7171
make test
7272
7373
- name: coverage
74-
image: golang:1.23
74+
image: golang:1.24
7575
env:
7676
- name: CODECOV_TOKEN
7777
valueFrom:

0 commit comments

Comments
 (0)