Skip to content

Commit

Permalink
Allow MOSCTL_BINARY and ZOT_BINARY to be read from the environment.
Browse files Browse the repository at this point in the history
This allows user that invokes make to influence the mosctl
and zot binary via MOSCTL_BINARY and ZOT_BINARY variables respectively.

The make variables will take the values present in the environment
or on the make command line if provided.

So either:

    export MOSCTL_BINARY=/tmp/my-mosctl
    export ZOT_BINARY=http://...

or

    make MOSCTL_BINARY=... ZOT_BINARY=...
  • Loading branch information
smoser committed Jul 18, 2023
1 parent c9b5115 commit c12fae7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
14 changes: 8 additions & 6 deletions layers/mos/stacker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ mos-build:
type: built
tag: build-krd
import:
- ${{MOSCTL_BINARY:https://github.com/project-machine/mos/releases/download/0.0.9/mosctl}}
- ${{ZOT_BINARY:https://github.com/project-zot/zot/releases/download/v1.4.3/zot-linux-amd64-minimal}}
- path: ${{MOSCTL_BINARY}}
dest: /imports/mosctl
- path: ${{ZOT_BINARY}}
dest: /imports/zot
- zot-config.json
run: |
d=$(mktemp -d)
Expand All @@ -23,10 +25,10 @@ mos-build:
cp /stacker/zot-config.json "$workd/etc/"
mkdir -p "$workd/usr/bin"
for bin in mosctl:mosctl zot-linux-amd64-minimal:zot ; do
t=$workd/usr/bin/${bin#*:}
cp -v /stacker/${bin%:*} $t
chmod 755 $t
for bin in mosctl zot; do
t="$workd/usr/bin/$bin"
cp -v /imports/${bin} "$t"
chmod 755 "$t"
done
# dracut-install will pick up all the deps for these binaries
Expand Down
6 changes: 5 additions & 1 deletion subs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ KEYSET ?= snakeoil
DOCKER_BASE ?= docker://
UBUNTU_MIRROR ?= http://archive.ubuntu.com/ubuntu
KEYSET_D ?= $(HOME)/.local/share/machine/trust/keys/$(KEYSET)
MOSCTL_BINARY ?= https://github.com/project-machine/mos/releases/download/0.0.9/mosctl
ZOT_BINARY ?= https://github.com/project-zot/zot/releases/download/v1.4.3/zot-linux-amd64-minimal

STACKER_SUBS = \
--substitute=KEYSET_D=$(KEYSET_D) \
--substitute=DOCKER_BASE=$(DOCKER_BASE) \
--substitute=UBUNTU_MIRROR=$(UBUNTU_MIRROR) \
--substitute=HOME=$(HOME) \
--substitute=KEYS_DIR=$(HOME)/.local/share/machine/trust/keys \
--substitute=TOP_D=$(TOP_D)
--substitute=TOP_D=$(TOP_D) \
--substitute=MOSCTL_BINARY=$(MOSCTL_BINARY) \
--substitute=ZOT_BINARY=$(ZOT_BINARY)

0 comments on commit c12fae7

Please sign in to comment.