Before submitting a pull request, please make sure your code is covered by tests.
The code is built with Maven and JDK 11. To build the plugin, please follow these steps:
- Clone the code from GitHub.
- Build and create the Bamboo Artifactory plugin jar by running the following Maven command:
mvn clean package
After the build finished, you'll find the bamboo-artifactory-plugin-<version>.jar
file under target directory.
This jar can be loaded into Bamboo.
To run integration tests, the plugin uses the Atlassian Wired tests infrastructure. The tests inject Bamboo variables to override Artifactory credentials and repositories.
- Install the Atlassian SDK. For example, to install with Homebrew run:
brew tap atlassian/tap
brew install atlassian/tap/atlassian-plugin-sdk
- Configure the following environment variables:
- ARTIFACTORY_URL
- ARTIFACTORY_USERNAME
- ARTIFACTORY_PASSWORD
- MAVEN_HOME
- GRADLE_HOME
To run the integration tests, execute the following command:
atlas-clean && atlas-integration-test -DskipITs=false
The integration tests store a Bamboo home instance in a zip file in src/test/resources/bamboo-home.zip.
The bamboo home is automatically loaded into the tests environment using atlas-*
commands.
To start the Bamboo server with the tests configuration run the following command:
atlas-debug
Running the above command will start a Tomcat server with the Bamboo CI server, and the Bamboo Artifactory plugin installed.
After the server is started, navigate to http://localhost:6990/bamboo. The credentials are admin:admin
.
The plugin's integration tests run the jobs under the Integration Tests project. To run a test, open the Developer Toolbar by clicking on the arrow in the lower left corner of your browser. Click Toolbox > Plugin Test Console. The test console appears. In this console you can run a specific test.
The integration test should include 2 parts:
- A job in the tests Bamboo home
- Java code in
src/test/java/it/org/jfrog/bamboo/<testname>Test.java
Tip: During the development of the test, you may change the Java code and start the server over and over again - make sure to not clean the code (using atlas-clean) because it will remove the changes you made to the temporary Bamboo Home environment. |
---|
- Create a new class extending IntegrationTestsBase, in src/test/java/it/org/jfrog/bamboo - see current tests for reference.
- Start the Bamboo server as instructed in the previous section. Make sure the new test appear in the Test Console.
- Temporarily, configure real Artifactory credentials in: http://localhost:6990/bamboo/admin/jfrogConfig.action
- Create a new plan under Integration Tests project. Make sure the plan key is same as in the Java code. The plan must capture the build info, include environment variables and finalized by the Artifactory Publish Build Info task.
- Run the test as instructed in the section above.
- Once the test passed, restore dummy Artifactory credentials configured in the UI.
- Stop the server by
CTRL+C
. - Run ./scripts/createBambooHome.sh to update the tests Bamboo home zip.