Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Add CI/CD example for building Argo Workflows using Argo Workflows - Fixes #8591 #13895

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

wesleyscholl
Copy link

A detailed example for implementing CI/CD pipelines to build Argo Workflows using Argo Workflows

Fixes #8591

Motivation

This issue was more than 2 years old and I wanted to contribute to the project. I also work with Argo Workflows everyday and I'm CAPA certified (Certified Argo Project Associate).

Modifications

WorkflowTemplate example includes:

CI

Description Resource Status
Argo Workflows API endpoint, submits WorkflowTemplate WorkflowEventBinding ☑️
Build the CLI WorkflowTemplate ☑️
Build images using Buildkit - Push images to Docker Hub WorkflowTemplate ☑️
Run unit tests and collect test report WorkflowTemplate ☑️
Run coverage and collect report WorkflowTemplate ☑️
Deploy to a cluster WorkflowTemplate ☑️
Run basic E2E tests and collect report WorkflowTemplate ☑️

Pipeline

Description Resource Status
Combine CI and CD jobs with an approval step WorkflowTemplate ☑️

CD

Description Resource Status
Tag and push tag WorkflowTemplate ☑️
Update deployment manifests using kustomize edit set image WorkflowTemplate ☑️
Commit deployment manifests WorkflowTemplate ☑️
Start Argo CD sync step WorkflowTemplate ☑️

Documentation & Configuration

Description Resource Status
CI, CD, & Pipeline Documentation Comments ☑️
Service Account for WorkflowEventBinding ServiceAccount ☑️
$ARGO_TOKEN - Bearer Authorization for WorkflowEventBinding Secret ☑️
Role to submit workflow templates for WorkflowEventBinding Role ☑️
RoleBinding the Role to the ServiceAccount for WorkflowEventBinding RoleBinding ☑️
Docker configuration - Hub credentials Secret ☑️
GitHub PAT - GitHub credentials Secret ☑️
ArgoCD server and credentials Secret ☑️
ArgoCD network policy NetworkPolicy ☑️

Verification

Thoroughly tested the workflow:

  • E2E Workflow
Screenshot 2024-11-10 at 2 03 19 PM
  • Workflow steps

  • clone-repo

Screenshot 2024-11-07 at 9 29 08 AM
  • build-cli
Screenshot 2024-11-07 at 9 50 37 AM
  • create-exec-image
Screenshot 2024-11-07 at 10 13 17 AM
  • create-cli-image
Screenshot 2024-11-07 at 10 55 04 AM
  • run-tests
Screenshot 2024-11-07 at 12 02 53 PM
  • run-coverage
Screenshot 2024-11-07 at 12 09 01 PM
  • prepare-deploy-to-cluster-e2e-test
Screenshot 2024-11-12 at 11 35 58 AM
  • approval
Screenshot 2024-11-08 at 1 00 57 PM
  • docker-tag-push
Screenshot 2024-11-08 at 1 04 11 PM
  • update-manifests
Screenshot 2024-11-08 at 1 04 46 PM
  • commit-manifests
Screenshot 2024-11-08 at 1 05 08 PM
  • start-argocd-sync
Screenshot 2024-11-08 at 1 07 01 PM

@wesleyscholl wesleyscholl marked this pull request as draft November 17, 2024 12:21
@wesleyscholl wesleyscholl marked this pull request as ready for review November 17, 2024 12:22
@wesleyscholl
Copy link
Author

For review: @alexec @terrytangyuan @sarabala1979 @caelan-io

Thanks

Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great but my main concern is how difficult it is to maintain this in this repo

@mubarak-j
Copy link

I'm not sure how this adds any complexity or burden when there are more than 50 examples in this repo. The lack of documentation/example for CI/CD use case, makes this a much-needed addition, as described in the linked issue.

@Joibel
Copy link
Member

Joibel commented Nov 21, 2024

I would like this to make it clear that it isn't a useful CI/CD for workflows, as it doesn't build everything and doesn't run all of the e2e tests. It doesn't build the controller.

It also feels like we should demonstrate a proper DAG, rather than running the whole thing in series. Build and test the components in parallel.

I'm also not sure that workflows is a good thing to demonstrate this on, as it's pretty peculiar and demonstrates bad practice - e.g. the argo-cli you build in the earlier test isn't the one under test in e2e.

@tico24 did a talk at argocon about doing the whole thing, including fixing some of this https://www.youtube.com/watch?v=q2jAPJHfubA

On the other hand, it would be good to have something in here. Perhaps explain the scope of what is going on and the caveats better in the example. This isn't like most of the other examples in there - the readme section of it is longer than most of the other actual examples in total, so I'm not sure all comparisons apply.

@mubarak-j
Copy link

I agree it would be good to have something in here considering that the last Argo workflows survery had CI/CD was the top use case and yet this repo lack an example for that. Like other examples (which are not meant to be full-fledged solutions), this is a great starting point...

@wesleyscholl
Copy link
Author

@terrytangyuan

The example is a bit long, but it includes all the requirements from #8591. Would be it easier to maintain if it was split into separate CI and CD WorkflowTemplates? Then link them in the docs.

@Joibel

Thanks for reviewing, this is the first CI/CD pipeline I've ever built. I want to modify this example to make it fully functional. For instance, adding this line to build the controller:

make controller kit STATIC_FILES=false

The workflow can implement a DAG to run all of the e2e tests in parallel and use the argo-cli build in the e2e tests.

As for the scope and caveats, should more comments be added to the example to explain each step in the workflow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an example of CI/CD - one that builds Argo Workflows, using Argo Workflows
4 participants