Skip to content

Latest commit

 

History

History
87 lines (51 loc) · 3.83 KB

File metadata and controls

87 lines (51 loc) · 3.83 KB

Contributing

Pull requests are welcome - we thank you in advance. All we ask is that your PR has a clear description of its purpose or intent and that the purpose of a PR is a singluar intent - we'd rather accept multiple smaller PRs than fewer big ones.

Setup

This provider uses the Custom Provider Framework from HashiCorp. A great reference is available from HashiCorp here.

Development is conducted using Go version defined in go.mod.

Documentation and examples should be regenerated and included in Pull Requests - run cd tools; go generate ./... before finalising your PR.

DO NOT MANUALLY EDIT FILES IN THE docs FOLDER - THEY ARE GENERATED BY THE ABOVE COMMAND!

Linting

Run golangci-lint run.

Testing

Unit Tests

These can be run locally by running go test -v -cover ./internal/provider/.

Acceptance/Integration Tests

These require an active and licensed Sonatype Nexus Repository Manager. PRs originating from outside this project will fail to pass the automated Integration Tests in CI due to our Repository Secrets not being available for these CI Executions (a GitHub restriction).

To run Integration Tests locally, set the following 3 environment variables and then run TF_ACC=1 go test -v -cover ./internal/provider/:

  • NXRM_SERVER_URL: Full URL to your Sonatype Nexus Repository Manager
  • NXRM_SERVER_USERNAME: Username to authenticate with
  • NXRM_SERVER_PASSWORD: Password to authentivate with

It is helpful when submitting Pull Requests to confirm whether you have been able to execute the Integraton Tests locally, but not mandatory.

Some Acceptance Tests rely on AWS, GCP or Sonatype IQ Server credentials/infrastructure to be run and be successful. These are disabled by default and can be enabled by setting the following environment variables per provider/service.

ACS (Azure Cloud Storage) Tests

Set TF_ACC_ACS_BLOB_STORE=1 to enable ACS blob store tests.

The following additional environment variables are required to authenticate with Azure:

  • TF_ACC_AZURE_ACCOUNT_KEY - Account key found under Access keys for the storage account
  • TF_ACC_AZURE_STORAGE_ACCOUNT_NAME - Storage Account Name

AWS (S3) Tests

Set TF_ACC_S3_BLOB_STORE=1 to enable S3 blob store tests.

The following additional environment variables are required to authenticate with AWS:

  • TF_ACC_AWS_ACCESS_KEY_ID
  • TF_ACC_AWS_ACCESS_SECRET_KEY

GCS (Google Cloud Storage) Tests

Set TF_ACC_GCP_BLOB_STORE=1 to enable GCP blob store tests

Sonatype IQ Server (Repository Firewall) Tests

Set TF_ACC_IQ_SERVER=1 to enable tests that exercise repository_firewall and sonatyperepo_system_iq_connection against a real Sonatype IQ Server - see #285. Without this flag, these tests are skipped, so a plain TF_ACC=1 run against NXRM alone still passes.

A real, licensed, running Sonatype IQ Server connected to the same NXRM instance under test is required. The following additional environment variables configure that connection (all optional

  • they default to the same local setup this provider's own CI uses):

  • IQ_SERVER_URL - defaults to http://localhost:8070

  • IQ_SERVER_USERNAME - defaults to admin

  • IQ_SERVER_PASSWORD - defaults to admin123

Standardised Development Patterns

See terraform-provider-shared and it's examples.

Sign off your commits

Please sign off your commits, to show that you agree to publish your changes under the current terms and licenses of the project, and to indicate agreement with Developer Certificate of Origin (DCO).

git commit --signed-off ...