A tool that helps you to test only those kustomize overlays that were affected by a merge in your CI.
Project description
Get chaged Kustomize overlays
When managing multiple applications across multiple clusters in a GitOps approach with kustomize there are a lot of overlays to test.
Kustomize doesn't even provide log output of it's transformations, this tool recursively calculates the dependencies of a given overlay and compares them with the files changed by a merge request, returning only those kustomize overlays that were affected by a merge request.
This tool does not check the validity of your kustomizations beyond resolving the paths of the dependencies, for proper linting use
oc apply --dry-run=server -f
or kubeconform.
Usage
usage: main.py [-h] --changed-files CHANGED_FILES [CHANGED_FILES ...] --base-overlays BASE_OVERLAYS [BASE_OVERLAYS ...] [-o OUTPUT_FILE]
optional arguments:
-h, --help show this help message and exit
--changed-files CHANGED_FILES [CHANGED_FILES ...]
The files that were changed
--base-overlays BASE_OVERLAYS [BASE_OVERLAYS ...]
The base overlays potentially affected
-o OUTPUT_FILE, --output-file OUTPUT_FILE
The output file path
Example
Manually
python -m get-changed-kustomize-overlays --changed-files folder1/file1.yaml folder2/file2.yaml --base-overlays folder1/kustomization.yaml folder2/kustomization.yaml
GitLab CI
OVERLAYS=$(find . -regex '.*/overlays/[a-z]*/kustomization.yaml' | tr '\n' ' ')
CHANGED_FILES=$(git diff --name-only $CI_MERGE_REQUEST_TARGET_BRANCH_SHA $CI_MERGE_REQUEST_SOURCE_BRANCH_SHA | tr '\n' ' ')
python -m get-changed-kustomize-overlays --changed-files $(echo $CHANGED_FILES) --base-overlays $(echo $OVERLAYS)
External dependencies
It is not possible to check for changes in external dependencies in CI pipelines that are triggered by merge requests, you should use tags or SHAs to signify changes in external dependencies.
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- https://github.com/ORGANIZATION/REPOSITORY.git//PATH_INSIDE_REPO?ref=<TAG/SHA>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file get_changed_kustomize_overlays-0.1.3.tar.gz
.
File metadata
- Download URL: get_changed_kustomize_overlays-0.1.3.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51bdb254ca9ef77aa87607ffc3a43d81c364bb509e443b2e425dabf99313e072 |
|
MD5 | 5e21bd88415f01d9d2800f41dd1db992 |
|
BLAKE2b-256 | 22d8bd1d9bbc13279933470aed809e23fd45e9c8c02fd5122927d4381a411c47 |
File details
Details for the file get_changed_kustomize_overlays-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: get_changed_kustomize_overlays-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 434642007d662971684974d7400a20d36bbe114d18f61c39a2d8ffa3144a99a1 |
|
MD5 | 021e8dad27270ea896ab1519b1ff66ae |
|
BLAKE2b-256 | 87dedbc40eb6fb455c42a596f6a8e343d76fd509342b39c1b68f89e169014b8a |