Last active
June 30, 2023 11:55
-
-
Save jorgemoralespou/1c9c15960dec0372bb49d40dd538970d to your computer and use it in GitHub Desktop.
ytt replacement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: test.sample.dev/v1beta1 | |
kind: Test | |
metadata: | |
name: name | |
spec: | |
exercises: | |
files: | |
- image: # Note: format is {repository-name}-files | |
url: $(image_repository)/files:latest | |
- path: .local/share/ | |
image: | |
url: $(image_repository)/extension-files:2.1.0 | |
- path: exercises | |
git: | |
url: https://github.com/sample/repo | |
ref: main | |
newRootPath: . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:overlay", "overlay") | |
#@ load("@ytt:data", "data") | |
#@ def startswith(index, left, right): | |
#@ return left.startswith(right) | |
#@ end | |
#@ def relocate(old, new): | |
#@ return lambda left, right: left.replace(old, new) | |
#@ end | |
#@ external_registry = "$(image_repository)" | |
#@ internal_registry = "ghcr.io" | |
#@overlay/match by=overlay.subset({"kind":"Test"}),expects="0+" | |
--- | |
spec: | |
exercises: | |
files: | |
#@overlay/match by=lambda i,l,r: "image" in l, expects="0+" | |
- image: | |
#@overlay/replace via=relocate(external_registry, internal_registry) | |
url: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment