Skip to content

Latest commit

 

History

History
106 lines (73 loc) · 4.4 KB

CONTRIBUTING.md

File metadata and controls

106 lines (73 loc) · 4.4 KB

Contributing

Contributions are welcome!

Dependency Management

K8s version

In our CI we test against a Kubernetes version that is supported by all Argo CD versions we support.

That version can be obtained when looking at this table in the Argo CD documentation.

Argo CD client-lib

Some dependencies we use are strictly aligned with the Argo CD client-lib that we use and should only be updated together:

  • github.com/argoproj/gitops-engine
  • k8s.io/*

Please don't update any of these dependencies without having discussed this first!

Building

  1. git clone this repository and cd into its directory
  2. make build will trigger the Golang build

The provided GNUmakefile defines additional commands generally useful during development, like for running tests, generating documentation, code formatting and linting. Taking a look at its content is recommended.

Testing

The acceptance tests run against a disposable ArgoCD installation within a Kind cluster. Other requirements are having a Docker daemon running and Kustomize installed.

make testacc_prepare_env
make testacc
make testacc_clean_env

Generating documentation

This provider uses terraform-plugin-docs to generate documentation and store it in the docs/ directory. Once a release is cut, the Terraform Registry will download the documentation from docs/ and associate it with the release version. Read more about how this works on the official page.

Use make generate to ensure the documentation is regenerated with any changes.

Using a development build

If running tests and acceptance tests isn't enough, it's possible to set up a local terraform configuration to use a development builds of the provider. This can be achieved by leveraging the Terraform CLI configuration file development overrides.

First, use make install to place a fresh development build of the provider in your ${GOBIN} (defaults to ${GOPATH}/bin or ${HOME}/go/bin if ${GOPATH} is not set). Repeat this every time you make changes to the provider locally.

Then write this config to a file:

provider_installation {
  dev_overrides {
    "argoproj-labs/argocd" = "/Users/username/go/bin" # path must be absolute and point to the directoy containing the binary
  }

  direct {}
}

And lastly use the following environment variable in a terminal session to tell Terraform to use this file for picking up the development binary:

export TF_CLI_CONFIG_FILE=../.reproduce/.terraformrc

For further reference consult HashiCorp's article about this topic.

Debugging

Hasicorp Docs: https://developer.hashicorp.com/terraform/plugin/debugging#starting-a-provider-in-debug-mode

Running the Terraform provider in debug mode

In VS Code open the Debug tab and select the profile "Debug Terraform Provider". Set some breakpoints and then run this task.

Then head to the debug console and copy the line where it says TF_REATTACH_PROVIDERS and copy it.

Now that your provider is running in debug-mode in VS Code, you can head to any terminal where you want to run a Terraform stack and prepend the terraform command with the copied text. The Terraform CLI will then ensure it's using the provider already running inside VS Code.

Running acceptance tests in debug mode

Open a test file, hover over a test function name and in the Debug tab hit "Debug selected Test". You shouldn't use the builtin "Debug Test" profile that is shown when hovering over a test function since it doesn't contain the necessary configuration to find your Argo CD environment.

Troubleshooting during local development