java - Jenkins: Use Archived Artifact in Promoted Build -
i've archived artifact last step of build , it's available this: https://xxx.ci.cloudbees.com/job/xxx/52/artifact/target/xxx-1.2.1-snapshot-r8304-20130807-1507-app.zip
how can access artifact in promotion process? please note need access specific build, not latest successful one.
the goal of promotion process copy artifact s3 our deployment job further process it. might promote build #52 development (copy specific s3 bucket), later on promote build #50 production , on.
ideally, can access artifact in shell script rename file etc. there environment variable access archived artifacts of build, cannot find or how should done? $build_url
, $job_url
specific promotion process , don't point build in shell scripts on promotion job.
with copy artifact plugin can copy artifacts other builds in promotion process, don't need do.
i believe have found solution.
summary
- do not use specified permalink
- use specific build , set build number
${promoted_number}
the solution
prerequisites
- the copy artifact plugin must installed.
- archive artifacts want promotions access
- in post-build actions add action archive artifacts , set files archive ever want promotion access.
- do not discard old artifacts
- in job configuration, deselect discard old builds or ensure settings keep artifacts long want promote builds.
promotion setup:
setup promoted build name , criteria usual.
in actions section add action copy artifacts other project, , set these values.
- project name:
${promoted_job_name}
- which build: specific build
- build number:
${promoted_number}
- artifacts copy:
path/to/your/artifacts/**
- target:
${build_tag}
then add actions want do. example add action archive artifacts save artifacts. remember prefix paths ${build_tag}
e.g. ${build_tag}/path/to/your/artifacts/**
notes on why
copying artifacts
as know now, promotion should not expect have access the content of workspace of build. might executed on different server, , might have access no workspace @ or workspace older or newer build. therefore required copy artifacts want use current workspace.
this reason why target value set. workspace might poluted other builds or promototions. setting target ${build_tag}
prevents conflicts files in workspace, creating folder unique promotion process.
${promoted_*} variables
as state normal build variables refer promotion process itself, promoted build plugin defines environment variables referring actual build instead.
permalinks
in jenkins context permalinks refers special links points latest build of type or latest promotion. why latest version
in version of jenkins dropdown replaced textbox. writing url specific build http://jenkins/job/myjob/59/
not recognized 1 of special permalinks, , copying will fail.
Comments
Post a Comment