Closed igor-ivanov closed 3 years ago
pipeline_stop is always executed and it has env variable indicating succ/fail, plz see example here:
https://github.com/Mellanox/ci-demo/blob/master/.ci/examples/job_matrix_containerSelector.yaml#L45
archiveArtifacts
can be used globally, per step, per pipeline-stop/start special steps as well
does it help?
pipeline_stop is always executed and it has env variable indicating succ/fail, plz see example here: https://github.com/Mellanox/ci-demo/blob/master/.ci/examples/job_matrix_containerSelector.yaml#L45
archiveArtifacts
can be used globally, per step, per pipeline-stop/start special steps as welldoes it help?
It does not help because pipeline_stop
is executed on master node when results can be collected from different $WORKSPACE
.
For example I found that $WORKSPACE
can point on different locations as
to /home/jenkins/agent/workspace/LIBVMA-PRO in steps but to /scrap/jenkins/workspace/LIBVMA-PRO when I use $WORKSPACE inside pipeline_stop.
attachArtifact (attachJunit, attachTap) can be per step as well and always executed (in step $WS) regardless if step failed or succeeded
attachArtifact (attachJunit, attachTap) can be per step as well and always executed (in step $WS) regardless if step failed or succeeded
It is clear. But I do not need to publishng artifacts in success on intermidiate step. Just as last step. And on failure when I know that last step is not reached I would like to collect artifacts. I would like to post artifatcs just once on failure step or as last step
you can add archiveTap
to last step only
if step-1 fails, step.archiveTap will not take effect
you can add
archiveTap
to last step only if step-1 fails, step.archiveTap will not take effect
Yep. It is a reason that this feature request was submitted
cool. can be closed? or I missed smth
cool. can be closed? or I missed smth
No. I would like to post artifatcs just once if on failure step or as last step. Current implementation does not allow to do what I need.
Existing project jenkins scripts supports test results collection internally in tar-file step by step and get all results in single file after failure or success comppletion. Getting such approach allows to use this locally w/o using jenkins and use in previous jenkins scheme. Submitting this tar-file on every step from ci-demo means getting mostly the same tar-file many times.
per step, one can use onfail
and always
directive to run commands.
if we expand onfail/always to specify attachXXX
- will it do it?
steps:
- name: step1
run: command
onfail:
archiveTap: '**/*.tap'
WDYT
This approach can solve my issue but has minor weakness.
I think ArchiveTap
and archiveArtifacts
should be supported unde onfail
Weakness: In this case I must duplicate the same code for all steps. There is a chance that doing modifications in one part a user can forget to repate it for all places.
For example I should duplicate:
run: |
if [ -d ${WORKSPACE}/jenkins ]; then
gzip ${WORKSPACE}/jenkins/*.tar 2>/dev/null || true
pushd ${WORKSPACE}/jenkins/ ;
for f in *.tar.gz ; do [ -e "$f" ] && mv "$f" "${name}-$f" ; done ;
popd
pushd ${WORKSPACE}/jenkins/${flags};
for f in *.tap ; do [ -e "$f" ] && mv "$f" "${BUILD_NUMBER}-${name}-${flags}-$f" ; done ;
popd
fi
archiveArtifacts: |
jenkins/*tar.gz,
jenkins/${flags}/*.tap
archiveTap: |
**/**/*.tap
@igor-ivanov - please see if following can be helpful: https://github.com/Mellanox/ci-demo/blob/master/.ci/examples/job_matrix_onfail.yaml#L32
added "-onfail" modifier support for archiveXXX
command
Thanks
Feature request:
It would be nice to have special step that is executed during failure when job stopes processing next steps. This ability can be used in following case when job should collect and publish artifacts just at the end.
onfail
does not help because it can describe commands but can not publish usingarchiveArtifacts