How to pass custom metadata to bamboo jobs and plan
Asked by sangeetha:

I found an option of injecting the metadata key value into properties file via script task (creating the properties file) and inject variable task . But is there any other option of passing the custom meta data without creating a file.


Answers:
author: Daniel Santos
body: Hi [@sangeetha](/t5/user/viewprofilepage/user-id/2185915),

If you want to create a variable with data that is generated during the build, that is the way we do it.

Can you elaborate more on what you are trying to achieve? We might be able to find a different path to solve your demand without creating the metadata.

comments: author: Victor Lopez
body: I want to track size of my javascript bundles within the plan. Is there a way to solve it using the metadata?


author: Daniel Santos
body: I guess not.  

Have you thought using artifacts for that?

You can save whatever information you need into a file and create an artifact with it. Once that is done you can load that artifact in other stages of the same plan or even in different plans.

Does that make sense?


author: Victor Lopez
body: Sorry, I'm newby in the CI. How can I use artifacts?

I'd like to make a report, like Clover, to see visualization of build size. May be I can customize Clover to use some additional values


author: Daniel Santos
body: Considering that you are new in Bamboo I would try understanding better how to work with artifacts to check if that is an option to solve your problem.  
Here you can find some references about it:

* [Sharing artifacts](https://confluence.atlassian.com/bamboo/sharing-artifacts-359400060.html)
* [Configuring a job's build artifacts](https://confluence.atlassian.com/bamboo/configuring-a-job-s-build-artifacts-289277071.html)

If you realize it will not be helpful then you can try the customisation path, but that will be a harder path. You will need to develop a Bamboo plugin your own.  
This is our developer documentation:

* [Bamboo developer documentation](https://developer.atlassian.com/server/bamboo/)

There is also something not clear to me. When you say build size, what size are you talking about?


author: Victor Lopez
body: Artifact for me is a docker container. During the build my code compiles and several compiled files are created in the "dist" folder of the container. I need to monitor the size of the compiled files.

Thanks for the links


author: sangeetha
body: Actually , I am trying to move the artifacts from pre-release folder to release folder with the version information. Currently we were told that this can be done using move artifacts option across repositories which is available only for admins and not to us(we dont have admin access). One of the option was to save the release number into a file and use the bamboo inject variable plugin to read the file during deployment. Is there any option available instead of creating a file.


author: Daniel Santos
body: Hi [@sangeetha](/t5/user/viewprofilepage/user-id/2185915),

I don't know the option of moving artifacts or something similar to it. Usually we publish artifacts and download them. Manipulating artifacts not using the download task will require managing physical folder locations that can even be in different agent servers.  

I would try to manage the version of the artifact on the artifact itself. You could for example publish the artifact with its version (on the artifact file name), download it in a different plan/deployment, use the version information from it (extracting using a simple script task) and renaming the artifact if needed.  

Versions of artifacts should be attached to the artifact itself, or the repository version. This would assure you that you have the exact information/artifact you need when releasing it.


author: Abhishek Mozumder
body: Hello [@Daniel Santos](/t5/user/viewprofilepage/user-id/502125) i want to pass on a custom metadata to the deploy job how can i do that. i have intentionally removed few of our other variable parameters. I want to use the Jira Ticket # in a deploy job.![Capture.JPG](https://community.atlassian.com/t5/image/serverpage/image-id/46666i97AE98D6ED55566C/image-size/large?v=v2&px=999 "Capture.JPG")


author: Daniel Santos
body: Hi [@Abhishek Mozumder](/t5/user/viewprofilepage/user-id/1344698)

Do you want to run the deployment, but customizing the variable when starting it?  
Or do you want to inherit the customized variable from the plan metadata?

If you want just to load a custom variable from a build plan, you should just reference it in the deployment. It should be able to use it as:

```
${bamboo.JiraTicket}
```

But if you want to run the deployment with a different option that will allow you to change the variable right at the moment the deployment is started, then you will probably need this add-on: [Custom Deployments for Bamboo \| Atlassian Marketplace](https://marketplace.atlassian.com/apps/1216138/custom-deployments-for-bamboo?hosting=server&tab=overview)


Tags: metadata