To import workflows, copy the examples/workflows directory to you repo .github dir on main branch.
While doing initial ci commits, include a [ci skip ] in commit message, to skip running the build-and-deploy workflow.
Workflows need following secrets to be set on repo level:
DOCKER_USERNAME
DOCKER_PASSWORD
KUBE_CONFIG
ETCD_USER # only when using etcd pull
ETCD_PASSWORD # only when using etcd pull
ETCD_HOST
Trigger conditions can be set per repo in workflow file
Runs either on push to main branch, or on manual trigger.
Steps:
- extract version from package.json / cargo.toml - file specified in cicd_inputs as version_file
- if a docker image tagged with this version hasn't been pushed to registry, build it
- if a git tag with this version doesn't exist, tag the commit
- deploy k8s manifests, using version read from version_file
- if etcd-pull is true, pull config from etcd and inject it into k8s secret, if changed restart deployment by adding checksum annotation
If there was a change in version, but not in manifests - job will build and run a new version.
If there was no change in version, but there was a change in manifest - job will run new manifests with the latest version.
If there was no changes in manifests, nor in version, job will do nothing.
Runs on manual trigger and requires a docker image tag to run.
Deploys given image to k8s
To enable k8s deploy, copy the examples/k8s directory to you repo root dir.
cicd-inputs file specifies variables to be passed to following pipelines and has to be set.
To enable pulling configuration from etcd, following line have to be added / uncommented from cicd-inputs:
pull_etcd_config: true # toggle etcd pull flag
etcd_key: /example/envs/.env.stage # key to be pulled
The file to be pulled has to be in key=value format coded as yaml.
Defined key will be pulled from etcd during workflow execution, and saved to a k8s secret named as {{ app_name }}-secret.
To mount secret as envs, add / uncomment follwing lines from deployment's manifest:
envFrom:
- secretRef:
name: example-secret