t1k:jenkins-test-pipeline
| Field | Value |
|---|---|
| Module | t1k-devops |
| Version | 4.1.3 |
| Effort | medium |
| Tools | — |
Keywords: CocosJenkinsScripts, folder library, groovy scripts, jenkins, jenkins-helper, JenkinsScripts, library branch, per-person folder, pipeline branch, RNJenkinsScripts, shared library, test pipeline, testpipeline
How to invoke
Section titled “How to invoke”/t1k:jenkins-test-pipeline<person-slug> --repo <library-repo-url> --branch <library-branch> [--jobs <TestPipeline job>...]Test a pipeline-library branch in a per-person TestPipeline folder
Section titled “Test a pipeline-library branch in a per-person TestPipeline folder”Game Jenkinsfiles do @Library('jenkins-helper') _. Jenkins resolves that name at the nearest
folder that defines it. The shared TestPipeline folder points jenkins-helper at ONE library
repo and branch, so two people testing two branches clobber each other. Fix: give each person a
TestPipeline/<person> folder with its own jenkins-helper entry; jobs inside it load the library
from that person’s branch, jobs elsewhere are untouched.
The shared folder’s library is live state, not a constant. It may point at a branch of ANY
engine’s library (it has pointed at CocosJenkinsScripts on a review branch), so a job created
directly in TestPipeline inherits that library whatever its own engine. Never create an ad-hoc job
there: read the entry first (get-config "" TestPipeline --out f.xml), and for a job whose engine
differs from it, or when unsure, use a per-person folder with --repo set to the engine’s library
(Unity JenkinsScripts). There is no library-less folder: create-folder always clones and rewrites
a jenkins-helper entry, so the engine’s own library is the closest a test job gets.
All Jenkins calls go through t1k-jenkins-job’s scripts/jenkins-job.cjs (auth resolution and
gotchas live there). This skill adds the flow; do not hand-roll curl.
S=~/.claude/skills/t1k-jenkins-job/scripts/jenkins-job.cjsHướng dẫn nhanh
Section titled “Hướng dẫn nhanh”- Chọn slug của bạn (kebab-case, vd
tuha), repo thư viện và nhánh cần test. bun $S create-folder TestPipeline <slug> --repo <repo> --branch <nhánh> --dry-run, xem rồi bỏ--dry-run.- Copy job cần test vào
TestPipeline/<slug>(xem Flow bước 4), build thử một lần, kiểm tra log cóLoading library jenkins-helper@<nhánh>. - Xong việc: trả nhánh về hoặc xoá folder (hỏi user trước, xem Cleanup).
Inputs
Section titled “Inputs”| Input | Source |
|---|---|
person slug | [a-z0-9-]; default from git config user.name, kebab-cased. Confirm with the user. |
| library repo | Unity git@github.com:The1Studio/JenkinsScripts.git (GroovyScripts/), Cocos CocosJenkinsScripts, RN RNJenkinsScripts |
| library branch | the branch under test |
| jobs to copy | names of existing TestPipeline jobs, or a spec via t1k-jenkins-unity / t1k-jenkins-cocos |
Ask the open ones in ONE AskUserQuestion (slug, repo, branch, jobs, Discord thread ID).
- Pre-check the branch.
git ls-remote --heads <repo> <branch>must be non-empty; run the library’s own CI gate (ci/in the library repo) if it has one. Stop on a missing branch. - Collision check.
bun $S list TestPipeline --grep <slug>. Folder exists: go to step 3b. - Create or repoint the folder.
- 3a new:
bun $S create-folder TestPipeline <slug> --repo <repo> --branch <branch> --dry-run, show the printed before/after, then rerun without--dry-run. It clones theTestPipelinefolder config and rewrites only thejenkins-helperurl, BranchSpec anddefaultVersion. - 3b existing (switch branch):
bun $S set-folder-library TestPipeline/<slug> --branch <branch> --dry-run, then without--dry-run; the command reads the config back and prints it.
- 3a new:
- Copy jobs into the folder, per job:
get-config TestPipeline <job> --out t.xml->gen --base t.xml --out j.xml --strip-triggers->create TestPipeline/<slug> <job> --from j.xml. Test jobs never build on push. Never inherit a thread ID:AskUserQuestionforPARAM_DISCORD_THREAD_IDfirst (see t1k-jenkins-job, “Never inherit a thread ID”), then--set PARAM_DISCORD_THREAD_ID=<id>. More than one job: smoke ONE, show it, then the rest (preview-first-batch). - Verify off the server. Folder:
get-config TestPipeline <slug> --out f.xmland read thejenkins-helperentry. Jobs:verify TestPipeline/<slug> <job> --expect-triggers no. Trigger a build only on the user’s OK, then confirm the console log containsLoading library jenkins-helper@...and that the checkout is<repo>at<branch>. A 200 from POST proves nothing. - Cleanup when the branch merges: repoint (
set-folder-library ... --branch master) or delete the folder. Deleting is destructive and often not permitted for CI accounts: ask the user, never create-then-delete scratch items.
Details, XML shape and what is verified vs unverified: references/folder-library.md.
Hard rules
Section titled “Hard rules”- Credentials: the cloned library keeps the parent’s
credentialsId; a repo in another org may fail only at first build.
Per-person library-branch testing in TestPipeline. Not for: editing Jenkinsfiles or library code,
creating production jobs (use t1k-jenkins-unity / t1k-jenkins-cocos), deleting items, managing
credentials.