Skip to content

Instantly share code, notes, and snippets.

@AndreSteenveld
Last active August 27, 2020 11:06
Show Gist options
  • Save AndreSteenveld/bfef53333573adadb5b7544e5bef5a23 to your computer and use it in GitHub Desktop.
Save AndreSteenveld/bfef53333573adadb5b7544e5bef5a23 to your computer and use it in GitHub Desktop.
Work around for YTT mixins
version: "3.7"
---
#@ load( "@ytt:template", "template" )
#@ def init_bash_shell( service_name ):
#@overlay/match by=overlay.all
#@overlay/match-child-defaults missing_ok=True
---
services:
#@yaml/text-templated-strings
(@= service_name @):
environment:
BASH_ENV: //mnt/dot-bashrc/.bashrc
volumes:
#@overlay/append
- type: volume
source: dot-bashrc
target: //mnt/dot-bashrc
read_only: true
#@ end
#@ def init_ash_shell( service_name ):
--- #@ template.replace( init_bash_shell( service_name ) )
#@overlay/match by=overlay.all
#@overlay/match-child-defaults missing_ok=True
---
services:
#@yaml/text-templated-strings
(@= service_name @):
environment:
ENV: //mnt/dot-bashrc/.bashrc sh
#@overlay/remove
BASH_ENV:
#@ end
---
#@ load( "@ytt:template", "template" )
#@ load( "@ytt:overlay", "overlay" )
#@overlay/match by=overlay.all
#@overlay/match-child-defaults missing_ok=True
---
#@overlay/assert
version: '3.7'
services:
first:
image: bash:5
volumes:
- other://root
--- #@ template.replace( init_bash_shell( "first" ) )
---
#@ load( "@ytt:template", "template" )
#@ load( "@ytt:overlay", "overlay" )
#@overlay/match by=overlay.all
#@overlay/match-child-defaults missing_ok=True
---
#@overlay/assert
version: '3.7'
services:
second:
image: busybox
--- #@ template.replace( init_ash_shell( "second" ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment