I have pipeline setup that looks similar to that of the pseudo code pasted below.
I am facing a problem with availability of `artifacts.txt` file in the Third step if in-case the Second step is skipped, which is a valid scenario for us.
But looks like whenever the second step is skipped, the artifacts file are not available for third step as well.
How can we get this enabled? Because as per the official documentation:
Artifacts that are created in a step are available to all the following steps.
But it doesn't mentioned what happens if one of the steps in between is skipped, do we have a way around this?
pipelines:
branches:
develop:
- step:
name: Generate Artifacts
script:
- echo "Generate Some Artifact" > artifacts.txt
artifacts:
- artifacts.txt
- step:
name: Optional Build Step
condition:
changesets:
includePaths:
- "build_dir/**"
script:
- echo "Only build if changes made in specific directory"
- step:
name: Mandatory Final Step
script:
- echo "Use artifacts.txt generated in step 1"
- DATA=$(cat artifacts.txt)
- echo "Some final steps of build"
Hi Asif and welcome to the community!
I ran a build using the bitbucket-pipelines.yml file you provided in your post but I am unable to reproduce this error. The file artifacts.txt is available in the third step of my build regardless of whether the second step runs or not.
I would suggest the following:
If you still cannot figure it out, you can post the build URL in the support ticket you created and the engineer working on your ticket can help with troubleshooting.
Please feel free to reach out if you have any questions!
Kind regards,
Theodora
Thank you @Theodora Boudale !
Your comment made me take another look at the code and failed builds, realized that there was an exit 0 line left over in an IF-ELSE block just above the code where the build is supposed to generate the artifact file.
The step was exiting with success status but without generating the artifact file itself!
Thank you for your suggestions!
- Asif
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the update Asif, it's good to hear that you figured this out!
Please feel free to reach out if you ever need anything else!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.