Skip to content

Commit 552d825

Browse files
committed
just: use released artifacts for demodir
When demoing Contrast, we usually want a stable software version with a minimum amount of surprises, so we would like to use the released binary and coordinator YAML for that. This commit adds a script that downloads the artifacts, which is a bit complicated because of visibility restrictions, and modifies the just target to use this script.
1 parent 33e7a41 commit 552d825

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

justfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,19 @@ fmt:
187187
lint:
188188
nix run .#scripts.golangci-lint -- run
189189

190-
demodir cli=default_cli: undeploy coordinator initializer
190+
demodir namespace="default": coordinator initializer
191191
#!/usr/bin/env bash
192192
d=$(mktemp -d)
193+
namespace=default
193194
echo "Creating demo directory at ${d}"
194-
nix build .#{{ cli }}
195-
cp ./result-cli/bin/contrast "${d}/contrast"
196195
cp -R ./deployments/emojivoto "${d}/deployment"
196+
rm -f "${d}/deployment/coordinator.yml"
197197
nix run .#scripts.patch-contrast-image-hashes -- "${d}/deployment"
198198
nix run .#kypatch images -- "${d}/deployment" \
199199
--replace ghcr.io/edgelesssys ${container_registry}
200+
nix run .#kypatch namespace -- "${d}/deployment" \
201+
--replace edg-default {{ namespace }}
202+
nix run .#scripts.fetch-latest-contrast -- {{ namespace }} "${d}"
200203
echo "Demo directory ready at ${d}"
201204
202205
# Cleanup auxiliary files, caches etc.

packages/scripts.nix

+20
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,24 @@ with pkgs;
168168
popd >/dev/null
169169
'';
170170
};
171+
172+
fetch-latest-contrast = writeShellApplication {
173+
name = "fetch-latest-contrast";
174+
runtimeInputs = [
175+
jq
176+
github-cli
177+
];
178+
text = ''
179+
namespace=$1
180+
targetDir=$2
181+
release=$(gh release list --json name,isLatest | jq -r '.[] | select(.isLatest) | .name')
182+
gh release download "$release" \
183+
--repo edgelesssys/contrast \
184+
-D "$targetDir" \
185+
--skip-existing
186+
chmod a+x "$targetDir/contrast"
187+
188+
yq -i ".metadata.namespace = \"$namespace\"" "$targetDir/coordinator.yaml"
189+
'';
190+
};
171191
}

0 commit comments

Comments
 (0)