Run post-deployment pipelines around pull-based deployments
Release notes
GitLab CI/CD pipelines are a core value offering for the majority of our customers. At the same time, the GitOps workflow of the agent for Kubernetes did not integrate with the pipelines. This release allows our users to define pipelines to run after a successful or failed pull-based deployment.
Problem to solve
As a Platform engineer, I want to auto-start E2E tests after the pull-based deployments are finished successfully.
As a Platform engineer, I want to start a remediation pipeline, if a pull-based deployment failed.
Proposal
Without CRDs
This proposal was created before we decided to move to Flux
Once gitops sync is done, agentk can send an event (via kas) to GitLab. It's then up to GitLab to act on that (via &8349 or #355658). Open questions here are:
- agentk syncs manifests every 5 minutes. Do we send an event each time? Deduplication? What if agentk restarts and syncs again - how to deduplicate that?
With CRDs - TBD
- Build on top of Flux's generic with HMAC notification provider
- Create an event listener in
agentkthat accepts notifications coming from Flux- the event listener checks the
GitRepositorybehind the event (the event might come from aKustomization) to find out its source in GitLab
- the event listener checks the
- Make
agentkto trigger outstanding jobs on the last pipeline related to the commit in the Flux event using the Jobs API - The job name is provided in a CR consumed by
agentk - The agent needs to be authorized to trigger jobs in the given project. Could we use
ci_accessfor this?
Proposed CR format:
apiVersion: pipelines.gitlab.com/v1
kind: JobTrigger
metadata:
name: my-trigger
spec:
source:
project: gitlab-org/gitlab
branch: main
secretRef:
name: my-gitlab-project-token
on_success:
job_name: qa-tests
variables:
HELLO: "világ"
on_failure:
job_name: revert
variables:
BYE: "világ"
Intended users
Feature Usage Metrics
- number of jobs triggered
Related
- https://github.com/fluxcd/flux2/discussions/3387
- Flux Notification GitHub provider triggering GitHub actions
This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.