Reuse existing Jenkins credential and trust isolated build checkout
This commit is contained in:
@@ -23,7 +23,7 @@ mkdir -p out
|
||||
}
|
||||
stage('Retrieve exact Actions bundle') {
|
||||
steps {
|
||||
withCredentials([string(credentialsId: 'final-project-gitea-read', variable: 'GITEA_TOKEN')]) {
|
||||
withCredentials([string(credentialsId: 'gitea-jenkins-ci', variable: 'GITEA_TOKEN')]) {
|
||||
sh '''set +x
|
||||
set -eu
|
||||
python3 ci/final_project.py fetch --sha "$SOURCE_SHA" --run-id "$ACTIONS_RUN_ID" --attempt "$ACTIONS_ATTEMPT" --mode "$MODE" --output out/review-bundle.zip > out/actions-run.json
|
||||
|
||||
+3
-2
@@ -22,8 +22,9 @@ Jenkins setup (requires an authenticated administrator):
|
||||
2. Pipeline from SCM: Git, existing public repository URL, branch
|
||||
*/feature/final-ci-demo, Script Path Jenkinsfile.final-project.
|
||||
3. Keep the existing myfileagent-python-ci required check unchanged.
|
||||
4. Create a Secret text credential final-project-gitea-read containing an
|
||||
appropriately scoped Gitea read token. Do not store it in Git or chat.
|
||||
4. Reuse existing Jenkins credential gitea-jenkins-ci. Its installed
|
||||
PersonalAccessTokenImpl implements StringCredentials and supports the
|
||||
string binding used here; no credential value was read during setup.
|
||||
5. Run once to load parameters; then Build with Parameters using the exact
|
||||
successful run SHA/ID/attempt. If branch HEAD has advanced, select the
|
||||
corresponding new successful run (pipeline refuses a checkout mismatch).
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow-definition plugin="workflow-job">
|
||||
<description>SSW590 Member 2 fixture pipeline. Simulated review, not live model evidence. Separate from the protected-main Python check.</description>
|
||||
<keepDependencies>false</keepDependencies>
|
||||
<properties>
|
||||
<hudson.model.ParametersDefinitionProperty>
|
||||
<parameterDefinitions>
|
||||
<hudson.model.StringParameterDefinition><name>SOURCE_SHA</name><description>Full SHA matching the selected Actions run and current Member 2 branch HEAD</description><defaultValue></defaultValue><trim>true</trim></hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition><name>ACTIONS_RUN_ID</name><description>Successful exact Actions run ID</description><defaultValue></defaultValue><trim>true</trim></hudson.model.StringParameterDefinition>
|
||||
<hudson.model.StringParameterDefinition><name>ACTIONS_ATTEMPT</name><defaultValue>1</defaultValue><trim>true</trim></hudson.model.StringParameterDefinition>
|
||||
<hudson.model.ChoiceParameterDefinition><name>MODE</name><choices class="java.util.Arrays$ArrayList"><a class="string-array"><string>fixture</string></a></choices></hudson.model.ChoiceParameterDefinition>
|
||||
</parameterDefinitions>
|
||||
</hudson.model.ParametersDefinitionProperty>
|
||||
</properties>
|
||||
<definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition" plugin="workflow-cps">
|
||||
<scm class="hudson.plugins.git.GitSCM" plugin="git">
|
||||
<configVersion>2</configVersion>
|
||||
<userRemoteConfigs><hudson.plugins.git.UserRemoteConfig><url>https://myfileagent.tech/myfileagent/myfileagent-pipeline.git</url></hudson.plugins.git.UserRemoteConfig></userRemoteConfigs>
|
||||
<branches><hudson.plugins.git.BranchSpec><name>*/feature/final-ci-demo</name></hudson.plugins.git.BranchSpec></branches>
|
||||
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
||||
<submoduleCfg class="empty-list"/>
|
||||
<extensions/>
|
||||
</scm>
|
||||
<scriptPath>Jenkinsfile.final-project</scriptPath>
|
||||
<lightweight>true</lightweight>
|
||||
</definition>
|
||||
<triggers/>
|
||||
<disabled>false</disabled>
|
||||
</flow-definition>
|
||||
@@ -9,6 +9,7 @@ case "$1" in
|
||||
--mount type=volume,src=ssw590-final-project-state,dst=/state \
|
||||
--workdir /work --entrypoint sleep "$image" 3600
|
||||
docker cp . "$name:/work"
|
||||
docker exec "$name" git config --global --add safe.directory /work
|
||||
;;
|
||||
exec) shift; docker exec "$name" "$@" ;;
|
||||
collect) mkdir -p out/collected; docker cp "$name:/work/out/." out/collected/ ;;
|
||||
|
||||
Reference in New Issue
Block a user