Skip to content

Latest commit

 

History

History
93 lines (66 loc) · 3.9 KB

CONTRIBUTIONS.md

File metadata and controls

93 lines (66 loc) · 3.9 KB

Contribution Guide

Contributors

Pull requests, issues and comments are welcomed. For pull requests:

  • Add tests for new features and bug fixes
  • Follow the existing style
  • Separate unrelated changes into multiple pull requests

See the existing issues for things to start contributing.

For bigger changes, make sure you start a discussion first by creating an issue and explaining the intended change.

JFrog requires contributors to sign a Contributor License Agreement, known as a CLA. This serves as a record stating that the contributor is entitled to contribute the code/documentation/translation to the project and is willing to have it used in distributions and derivative works (or is willing to transfer ownership).

Build the Provider

Simply run make install - this will compile the provider and install it to ~/.terraform.d. When running this, it will take the current tag and bump it 1 minor version. It does not actually create a new tag (that is make release). If you wish to use the locally installed provider, make sure your TF script refers to the new version number.

Requirements:

  • Terraform 0.13
  • Go 1.18+ (to build the provider plugin)

Building on macOS

This provider uses GNU sed as part of the build toolchain, in both Linux and macOS. This provides consistency across OSes.

If you are building this on macOS, you have two options:

Using gnu-sed

After installing with brew, get the GNU sed information:

$ brew info gnu-sed

You should see something like:

GNU "sed" has been installed as "gsed".
If you need to use it as "sed", you can add a "gnubin" directory
to your PATH from your bashrc like:

     PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"

Add the gnubin directory to your .bashrc or .zshrc per instruction so that sed command uses gnu-sed.

Testing

Since JFrog Xray is an addon for Artifactory, you will need a running instance of the JFrog platform (Artifactory and Xray). However, there is no currently supported dockerized, local version. The fastest way to install Artifactory and Xray as a self-hosted installation is to use Platform Helm chart. Free 30 days trial version is available here If you want to test on SaaS instance - 30 day trial can be freely obtained and will allow local development.

Then, you have to set some environment variables as this is how the acceptance tests pick up their config:

JFROG_URL=http://localhost:8081
XRAY_ACCESS_TOKEN=your-admin-key
TF_ACC=true

a crucial, and very much hidden, env var to set is TF_ACC=true - you can literally set TF_ACC to anything you want, so long as it's set. The acceptance tests use terraform testing libraries that, if this flag isn't set, will skip all tests.

XRAY_ACCESS_TOKEN can be generated in the UI. Go to Settings -> Identity and Access -> Access Tokens -> Generate Admin Token

You can then run the tests as make acceptance. You can check what it's doing on the background in the GNUmakefile in the project.

We've found that it's very convenient to use Charles proxy to see the payload, generated by Terraform Provider during the testing process. You can also use any other network packet reader, like Wireshark and so on.

Registry documentation generation

All the documentation in the project is generated by tfplugindocs. If you make any changes to the resource schemas, you will need to re-generate documentation. Install tfplugindocs, then run:

$ make doc

Thanks for contributing!