Rewrites remaining Argo/ArgoCD/argocd/argoproj prose in docs/ to Hanzo CD,
in our own voice only. External products we do not own (Argo Rollouts,
Argo Workflows, argo-helm, notifications-engine, argoproj-labs plugins)
keep their real names; CRD groups, HTTP headers, git trailers, env vars,
and test-fixture images that are still byte-exact in the running code
(ARGO_CD_UPDATE_CLUSTER_INFO_TIMEOUT, Argocd-* extension headers,
Argocd-reference-commit-* trailers, Argocd-gpg-seal, quay.io/argoprojlabs
cd-e2e-container) are left untouched.
Deletes docs/operator-manual/upgrading/1.0-1.1.md through 3.4-3.5.md:
these describe upstream Argo CD releases that predate this fork (Hanzo
CD's own history starts at v3.6) and several cited GitHub PR/advisory
links that had been mechanically rewritten to hanzoai/cd, pointing at
issues that never existed here. Deletes docs/developer-guide/dependencies.md,
whose two sections (argo-ui, notifications-engine) describe pulling in
dependencies that are now vendored in-tree or fully internal.
Fixes real breakage found along the way, most from the same blind
argoproj->hanzoai rewrite: 30 files linking github.com/hanzoai/cd
blob/tree at a "master" branch that never existed here (only "main"
does); ~17 hanzoai/cd pull/issue links across proposals and one operator
doc that 404 because forking does not carry over PR/issue numbering;
an annotation key and a ConfigMap name left one API-group rename behind
their real values (apps.hanzo.ai/*, cd-rbac-cm); a page rename
(Argo-CD-Integration.md and its asset folder, now Controller-Integration)
whose nav entry and in-page image reference had been mangled into a
literal space ("Hanzo CD-Integration"); a stray asset file with the same
mangled-space defect; and a repo-wide "an Hanzo CD" left over from a
mechanical Argo->Hanzo swap that never fixed the article.
mkdocs.yml: trims the Upgrading nav to the one real entry, drops
dependencies.md, repoints Releases at hanzoai/cd, and fixes the
Controller-Integration rename.
Verified with a strict mkdocs build (0 warnings) after the fixes above.
Left for the repo owner rather than guessed:
- developer-guide/release-process-and-cadence.md and
proposals/feature-bounties*.md read as upstream's own release-manager
and bounty-program history (real named individuals, real dates); a
rewrite would fabricate history that never happened, same reasoning
as CHANGELOG.md.
- assets/versions.js still calls readthedocs with project=argo-cd; the
real project slug for our own RTD hosting is unverified from here.
- signed-release-assets.md's cosign --certificate-identity-regexp still
names .github/workflows/image-reuse.yaml, which does not exist in this
repo (no .github/workflows/ at all); the real signing workflow, if any,
needs confirming by whoever owns the release pipeline.
- maintaining-internal-cd-forks.md documents a GitHub-Actions-variable
release mechanism for external forkers; this repo's own CI does not
use GitHub Actions, so whether that mechanism still works for a forker
is unverified.
6.8 KiB
The Development Cycle
Prerequisites
Preface
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.
Docker privileges for virtualized toolchain users
These instructions are relevant for most of the steps below
Using Podman for virtualized toolchain users
These instructions are relevant for most of the steps below
Development cycle steps
Set kubectl context to cd namespace
Setting kubectl config to the cd 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=cd
Pull in all UI build dependencies
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-uiormake dep-ui-local
These commands run pnpm install --frozen-lockfile command, which only brings package versions that are defined in the pnpm-lock.yaml file without trying to resolve and download new package versions.
Updating UI build dependencies
If you need to add new UI dependencies or update existing ones you need
to run a pnpm command in the ./ui directory to resolve and download new packages.
You can run it in the docker container using the make run-pnpm make target.
For example, to add new dependency newpackage you may run command like
make run-pnpm PNPM_COMMAND="add newpackage --ignore-scripts"
To upgrade an existing package:
make run-pnpm PNPM_COMMAND="update [email protected] --ignore-scripts"
Please consider using best security practices when adding or upgrading NPM dependencies, such as this guide.
Generate API glue code and other assets
Hanzo 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.
- Run
make codegenormake codegen-local, this might take a while - Check if something has changed by running
git statusorgit diff - Commit any possible changes to your local Git branch, an appropriate commit message would be
Changes 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.
Build your code and run unit tests
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 buildormake build-localmake testormake test-local
These steps are non-modifying, so there's no need to check for changes afterward.
Lint your code base
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.
- Run
make lintormake lint-localand observe any errors reported by the Linter - Fix any of the errors reported and commit to your local branch
- Finally, after the Linter reports no errors, run
git statusorgit diffto check for any changes made automatically by Lint - If there were automatic changes, commit them to your local branch
If you touched UI code, you should also run the linter on it:
- Run
make lint-uiormake lint-ui-local - Fix any of the errors reported by it
Run end-to-end tests
The final step is running the End-to-End testsuite, which ensures that your Kubernetes dependencies are working properly. This will involve starting all the Hanzo CD components on your computer. The end-to-end tests consists of two parts: a server component, and a client component.
- First, start the End-to-End server:
make start-e2eormake start-e2e-local. This will spawn a number of processes and services on your system. - When all components have started, run
make test-e2eormake test-e2e-localto run the end-to-end tests against your local services.
Below you can find a few examples of how to run specific tests.
- To run a single test with a local toolchain, you can use
TEST_FLAGS="-run TestName" make test-e2e-local. - To run a specific package, you can use
make TEST_MODULE=./test/e2e/<TEST_FILE>.go test-e2e-local - Finally, you can also try
make TEST_FLAGS="-run <TEST_METHOD_NAME_REGEXP>" test-e2e-localif you want a more fine-grained control.
For more information about End-to-End tests, refer to the End-to-End test documentation.
Common Make Targets
Here are some frequently used make targets (all will run on your machine):
Local Toolchain Make Targets
make install-tools-local- Install testing and building tools for the local toolchainmake build-local- Build Hanzo 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 Hanzo CDmake cli-local- Build Hanzo CD CLI binary
Virtualized Toolchain Make Targets
make 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 Hanzo 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 Hanzo CD
Congrats on making it to the end of this runbook! 🚀
For more on Hanzo CD, see GitHub Issues.