Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

just: use released artifacts for demodir #202

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,18 @@ fmt:
lint:
nix run .#scripts.golangci-lint -- run

demodir cli=default_cli: undeploy coordinator initializer
demodir namespace="default": coordinator initializer
#!/usr/bin/env bash
d=$(mktemp -d)
echo "Creating demo directory at ${d}"
nix build .#{{ cli }}
cp ./result-cli/bin/contrast "${d}/contrast"
cp -R ./deployments/emojivoto "${d}/deployment"
rm -f "${d}/deployment/coordinator.yml"
nix run .#scripts.patch-contrast-image-hashes -- "${d}/deployment"
nix run .#kypatch images -- "${d}/deployment" \
--replace ghcr.io/edgelesssys ${container_registry}
nix run .#kypatch namespace -- "${d}/deployment" \
--replace edg-default {{ namespace }}
nix run .#scripts.fetch-latest-contrast -- {{ namespace }} "${d}"
echo "Demo directory ready at ${d}"

# Cleanup auxiliary files, caches etc.
Expand Down
20 changes: 20 additions & 0 deletions packages/scripts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,24 @@ with pkgs;
popd >/dev/null
'';
};

fetch-latest-contrast = writeShellApplication {
name = "fetch-latest-contrast";
runtimeInputs = [
jq
github-cli
];
text = ''
namespace=$1
targetDir=$2
release=$(gh release list --json name,isLatest | jq -r '.[] | select(.isLatest) | .name')
gh release download "$release" \
--repo edgelesssys/contrast \
-D "$targetDir" \
--skip-existing
chmod a+x "$targetDir/contrast"

yq -i ".metadata.namespace = \"$namespace\"" "$targetDir/coordinator.yaml"
'';
};
}
Loading