docs/developer-guide/development-cycle.md
When you have developed and possibly manually tested the code you want to contribute, you should ensure that everything builds correctly. Commit your changes locally and perform the following steps, for each step the commands for both local and virtualized toolchain are listed.
These instructions are relevant for most of the steps below
These instructions are relevant for most of the steps below
Setting kubectl config to the argocd namespace is required for these steps to succeed. All following commands in this guide assume the namespace is already set.
kubectl config set-context --current --namespace=argocd
As build dependencies change over time, you have to synchronize your development environment with the current specification. In order to pull in all required UI dependencies (NPM packages), issue:
make dep-ui or make dep-ui-localThese commands run yarn install --frozen-lockfile command, which only brings package versions that are defined in the yarn.lock file without trying to resolve and download new package versions.
If you need to add new UI dependencies or update existing ones you need
to run a yarn command in the ./ui directory to resolve and download new packages.
You can run it in the docker container using the make run-yarn make target.
For example, to add new dependency newpackage you may run command like
make run-yarn YARN_COMMAND="add newpackage --ignore-scripts"
To upgrade an existing package:
make run-yarn YARN_COMMAND="upgrade [email protected] --ignore-scripts"
Please consider using best security practices when adding or upgrading NPM dependencies, such as this guide.
Argo CD relies on Google's Protocol Buffers for its API, and this makes heavy use of auto-generated glue code and stubs. Whenever you touched parts of the API code, you must re-generate the auto generated code.
make codegen or make codegen-local, this might take a whilegit status or git diffChanges from codegen, for example.[!NOTE] There are a few non-obvious assets that are auto-generated. You should not change the autogenerated assets, as they will be overwritten by a subsequent run of
make codegen. Instead, change their source files. Prominent examples of non-obvious auto-generated code areswagger.jsonor the installation manifest YAMLs.
After the code glue has been generated, your code should build and the unit tests should run without any errors. Execute the following statements:
make build or make build-localmake test or make test-localThese steps are non-modifying, so there's no need to check for changes afterward.
In order to keep a consistent code style in our source tree, your code must be well-formed in accordance to some widely accepted rules, which are applied by a Linter.
The Linter might make some automatic changes to your code, such as indentation fixes. Some other errors reported by the Linter have to be fixed manually.
make lint or make lint-local and observe any errors reported by the Lintergit status or git diff to check for any changes made automatically by LintIf you touched UI code, you should also run the Yarn linter on it:
make lint-ui or make lint-ui-localThe final step is running the End-to-End testsuite, which ensures that your Kubernetes dependencies are working properly. This will involve starting all the Argo CD components on your computer. The end-to-end tests consists of two parts: a server component, and a client component.
make start-e2e or make start-e2e-local. This will spawn a number of processes and services on your system.make test-e2e or make test-e2e-local to run the end-to-end tests against your local services.Below you can find a few examples of how to run specific tests.
TEST_FLAGS="-run TestName" make test-e2e-local.make TEST_MODULE=./test/e2e/<TEST_FILE>.go test-e2e-localmake TEST_FLAGS="-run <TEST_METHOD_NAME_REGEXP>" test-e2e-local if you want a more fine-grained control.For more information about End-to-End tests, refer to the End-to-End test documentation.
Here are some frequently used make targets (all will run on your machine):
make install-tools-local - Install testing and building tools for the local toolchainmake build-local - Build Argo CD binariesmake test-local - Run unit testsmake codegen-local - Re-generate auto generated Swagger and Protobuf (after changing API code)make lint-local - Run lintingmake pre-commit-local - Run pre-commit checksmake start-e2e-local - Start server for end-to-end testsmake test-e2e-local - Run end-to-end testsmake serve-docs-local - Serve documentationmake start-local - Start Argo CDmake cli-local - Build Argo CD CLI binarymake verify-kube-connect - Test whether the virtualized toolchain has access to your K8s clustermake test-tools-image - Prepare the environment of the virtualized chainmake build - Build Argo CD binariesmake test - Run unit testsmake codegen - Re-generate auto generated Swagger and Protobuf (after changing API code)make lint - Run lintingmake pre-commit - Run pre-commit checksmake start-e2e - Start server for end-to-end testsmake test-e2e - Run end-to-end testsmake serve-docs - Serve documentationmake start - Start Argo CDCongrats on making it to the end of this runbook! 🚀
For more on Argo CD, find us in Slack - https://slack.cncf.io/ #argo-contributors