github.com/argoproj/argo-cd/v3@v3.2.1/docs/developer-guide/development-cycle.md (about)

     1  # The Development Cycle
     2  
     3  ## Prerequisites
     4  1. [Development Environment](development-environment.md)   
     5  2. [Toolchain Guide](toolchain-guide.md)
     6  
     7  ## Preface 
     8  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. 
     9  
    10  ### Docker priviliges for virtualized toolchain users
    11  [These instructions](toolchain-guide.md#docker-privileges) are relevant for most of the steps below 
    12  
    13  ### Using Podman for virtualized toolchain users
    14  [These instructions](toolchain-guide.md#using-podman) are relevant for most of the steps below 
    15  
    16  ## Development cycle steps
    17  ### Set kubectl context to argocd namespace
    18  
    19  Setting kubectl config to the argocd namespace is required for these steps to succeed.
    20  All following commands in this guide assume the namespace is already set.
    21  
    22  ```shell
    23  kubectl config set-context --current --namespace=argocd
    24  ```
    25  
    26  ### Pull in all build dependencies
    27  
    28  As build dependencies change over time, you have to synchronize your development environment with the current specification. In order to pull in all required dependencies, issue:
    29  
    30  * `make dep-ui` or `make dep-ui-local`
    31  
    32  Argo CD recently migrated to Go modules. Usually, dependencies will be downloaded at build time, but the Makefile provides two targets to download and vendor all dependencies:
    33  
    34  * `make mod-download` or `make mod-download-local` will download all required Go modules and
    35  * `make mod-vendor` or `make mod-vendor-local` will vendor those dependencies into the Argo CD source tree
    36  
    37  ### Generate API glue code and other assets
    38  
    39  Argo CD relies on Google's [Protocol Buffers](https://developers.google.com/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.
    40  
    41  * Run `make codegen` or `make codegen-local`, this might take a while
    42  * Check if something has changed by running `git status` or `git diff`
    43  * Commit any possible changes to your local Git branch, an appropriate commit message would be `Changes from codegen`, for example.
    44  
    45  !!!note
    46      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 are `swagger.json` or the installation manifest YAMLs.
    47  
    48  ### Build your code and run unit tests
    49  
    50  After the code glue has been generated, your code should build and the unit tests should run without any errors. Execute the following statements:
    51  
    52  * `make build` or `make build-local`
    53  * `make test` or `make test-local`
    54  
    55  These steps are non-modifying, so there's no need to check for changes afterward.
    56  
    57  ### Lint your code base
    58  
    59  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.
    60  
    61  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.
    62  
    63  * Run `make lint` or `make lint-local` and observe any errors reported by the Linter
    64  * Fix any of the errors reported and commit to your local branch
    65  * Finally, after the Linter reports no errors, run `git status` or `git diff` to check for any changes made automatically by Lint
    66  * If there were automatic changes, commit them to your local branch
    67  
    68  If you touched UI code, you should also run the Yarn linter on it:
    69  
    70  * Run `make lint-ui` or `make lint-ui-local`
    71  * Fix any of the errors reported by it
    72  
    73  ### Run end-to-end tests
    74  
    75  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 Argo CD components on your computer. The end-to-end tests consists of two parts: a server component, and a client component.
    76  
    77  * First, start the End-to-End server: `make start-e2e` or `make start-e2e-local`. This will spawn a number of processes and services on your system.
    78  * When all components have started, run `make test-e2e` or `make test-e2e-local` to run the end-to-end tests against your local services.
    79  
    80  To run a single test with a local toolchain, you can use `TEST_FLAGS="-run TestName" make test-e2e-local`.
    81  
    82  For more information about End-to-End tests, refer to the [End-to-End test documentation](test-e2e.md).
    83  
    84  ## Common Make Targets
    85  
    86  Here are some frequently used make targets (all will run on your machine):
    87  
    88  ### Local Toolchain Make Targets
    89  
    90  * `make install-tools-local` - Install testing and building tools for the local toolchain 
    91  * `make build-local` - Build Argo CD binaries
    92  * `make test-local` - Run unit tests
    93  * `make codegen-local` - Re-generate auto generated Swagger and Protobuf (after changing API code)
    94  * `make lint-local` - Run linting
    95  * `make pre-commit-local` - Run pre-commit checks
    96  * `make start-e2e-local` - Start server for end-to-end tests
    97  * `make test-e2e-local` - Run end-to-end tests
    98  * `make serve-docs-local` - Serve documentation
    99  * `make start-local` - Start Argo CD
   100  * `make cli-local` - Build Argo CD CLI binary
   101  
   102  ### Virtualized Toolchain Make Targets
   103  
   104  * `make verify-kube-connect` - Test whether the virtualized toolchain has access to your K8s cluster
   105  * `make test-tools-image` - Prepare the environment of the virtualized chain
   106  * `make build` - Build Argo CD binaries
   107  * `make test` - Run unit tests
   108  * `make codegen` - Re-generate auto generated Swagger and Protobuf (after changing API code)
   109  * `make lint` - Run linting
   110  * `make pre-commit` - Run pre-commit checks
   111  * `make start-e2e` - Start server for end-to-end tests
   112  * `make test-e2e` - Run end-to-end tests
   113  * `make serve-docs` - Serve documentation
   114  * `make start` - Start Argo CD
   115  
   116  ---
   117  Congrats on making it to the end of this runbook! 🚀
   118  
   119  For more on Argo CD, find us in Slack - <https://slack.cncf.io/> [#argo-contributors](https://cloud-native.slack.com/archives/C020XM04CUW)