ARTIFACTORY: How to deploy Generic Artifacts using Bamboo Datacenter and Artifactory Bamboo plugin?
Artifactory provides integration with Bamboo through the Bamboo Artifactory Plugin.
The Bamboo Artifactory Plugin is fully tested for compatibility with the version of Bamboo that is current when the plugin is released. You can find the Plugin version compatible with each Bamboo version from the link here.
The Bamboo Artifactory Plugin currently provides full support for Maven, Gradle, Ivy, NPM, Docker, NuGet and Generic builds through dedicated Artifactory tasks for each of these package managers.
Installing Artifactory PluginIn this guide, we are using Bamboo Data Center Version 9.3.2. The plugin version compatible with this will be Bamboo Artifactory Plugin version 3.3.2.
Note: You can ignore the message “Not datacenter Approved”, as this doesn’t mean that it is not supported, but few requirements to get the approval may not be fully satisfied.
Configure the Artifactory server in BambooIn order to use the Artifactory tasks, you have to configure the Artifactory server using the plugin.
4. Test the connection and save.
Prepare Bamboo project for the deployment- Create a new project with a name say ‘MyBambooJFrogtest’ from the Top menu.
- Then, create a plan under the project with a name say ‘DeployGenericTest’. You can link it with any git repository or choose ‘none’ to use the files in the default build directory.
- Go to the plan and select “Configure plan” under Actions.
- Now, under the Stages & Jobs, you can select the default job or add new Job
- Click on Add task
- This will show you all the tasks available and you can choose it according to the requirement. Here, we can choose ‘Artifactory Generic Deploy’.
How to configure an Artifactory Generic Deploy task?- Give a description for the Task you created
- Select the Artifactory server where you want to deploy the files
- Select “Upload by specs” (The legacy pattern is already depreciated and it is not recommended)
- Select “upload spec source”
- Task Configuration
- File
If you select Task configuration, you can specify the “File spec” pattern directly inside the “spec” text box.
For example:
{
"files": [
{
"pattern": "${bamboo.build.working.directory}/*.txt",
"target": "test-bamboo-generic/test/"
}
]
}
The above will copy all the text files inside the build working directory to the repository ‘test-bamboo-generic’ in the Artifactory within the path ‘test’.
If you select “File”, you have the option to specify the path to the “File spec ” configuration file in the text box “File path” relative to the Bamboo build working directory.
For example:
specs/file1.json
Here,
$ cat specs/file1.json
{
"files": [
{
"pattern": "${bamboo.build.working.directory}/(*)",
"target": "test-bamboo-generic/test2/"
}
]
}
5. You can click on “Run” and “Run Plan”. This will deploy the files to the Artifactory based on the given Filespecs task configuration.
Log snippet:
simple 06-Sep-2023 17:27:01 Usage info sent successfully.
simple 06-Sep-2023 17:27:01 Bamboo Artifactory Plugin version: 3.3.2
simple 06-Sep-2023 17:27:01 Using task configuration spec
simple 06-Sep-2023 17:27:01 Spec: { "files": [ { "pattern": "/Users/xxxxxx/bamboo-datacenter/local-working-dir/MYB-DEP-JOB1/*.txt", "target": "test-bamboo-generic/test/" } ]}
simple 06-Sep-2023 17:27:01 [consumer_0] Deploying artifact: http://localhost:8082/artifactory/test-bamboo-generic/test/test1.txt
simple 06-Sep-2023 17:27:01 [consumer_1] Deploying artifact: http://localhost:8082/artifactory/test-bamboo-generic/test/test2.txt
simple 06-Sep-2023 17:27:03 Finished task 'deployTextFiles' with result: SuccessIf you're already using the Artifactory Bamboo Plugin, we recommend also installing the JFrog Bamboo Plugin, and gradually migrate your jobs from the old plugin to the new one. You can also have your existing plans use the two plugins. The old plugin will continue to be supported, however new functionality will most likely make it into the new plugin only.
Referenceshttps://jfrog.com/help/r/jfrog-integrations-documentation/the-artifactory-generic-deploy-task