20
vRA Code Stream – Preserving files and artifacts created in a CI Task
Whilst creating a pipeline and using CI Tasks to run some CLI tools, I needed to save the outputted files from the container used for the CI Task so I could use them once the pipeline is completed.
Code Stream has a feature for CI Tasks called “Preserve Artifacts” to enable this, where by files in your working directory are saved to the “/sharedPath” folder location of the Docker Host where your container runs.
Below I’m going to show you how to use this feature.
- First on your pipeline configure a Working Directory
- On your CI task steps move your outputted files to your Working Directory folder.
- In my example I will have SSH key files created in ~/.ssh so I need to move them to my folder /workingDir which is specified at the previous steps
- Under the “Preserve Artifacts” section of the CI Task, specify the filenames you want to be preserved.
- Now run your Pipeline, open the execution and on the CI Task where your artifacts are created you will see the details of where these files are located on your Docker Host.
- If you view the Output JSON, you can see the details you can use as outputs to reference in further tasks in the pipeline.
As an example, here I’ve setup an email notification on my pipeline task that sends me the location of the artifact on the docker host.
Here is a quick screenshot of the email from the above example.
- Log onto your Docker Host, and browse to the location provided on the Output
Thanks to Sam McGeown for his assistance with this!
Regards
The post vRA Code Stream – Preserving files and artifacts created in a CI Task appeared first on vEducate.co.uk.
20