From 3ce2b86e7b4760329ad5f863528eb90a26951e2d Mon Sep 17 00:00:00 2001 From: bodymindarts Date: Fri, 27 Oct 2023 20:18:51 +0200 Subject: [PATCH] ci: get Tilt working in concourse --- .github/workflows/tilt.yml | 2 +- ci/apps/app-template.lib.yml | 5 +---- ci/apps/tasks/run-on-nix-host.sh | 20 +++++++++----------- dev/Tiltfile | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/tilt.yml b/.github/workflows/tilt.yml index 489b90ef04..f094608ad4 100644 --- a/.github/workflows/tilt.yml +++ b/.github/workflows/tilt.yml @@ -29,4 +29,4 @@ jobs: echo "Prepared args: $ARGS" echo "args=$ARGS" >> "$GITHUB_OUTPUT" - name: Tilt CI - run: nix develop -c bash -c "cd dev && xvfb-run tilt ci -- ${{ steps.prepare_args.outputs.args }}" + run: nix develop -c xvfb-run tilt --file dev/Tiltfile ci -- ${{ steps.prepare_args.outputs.args }} diff --git a/ci/apps/app-template.lib.yml b/ci/apps/app-template.lib.yml index 7db202a031..90a9d88b2b 100644 --- a/ci/apps/app-template.lib.yml +++ b/ci/apps/app-template.lib.yml @@ -117,7 +117,7 @@ plan: #@ params["GOOGLE_CREDENTIALS"] = "((staging-gcp-creds.creds_json))" #@ params["SSH_PRIVATE_KEY"] = "((staging-ssh.ssh_private_key))" #@ params["SSH_PUB_KEY"] = "((staging-ssh.ssh_public_key))" -#@ params["CMD"] = "cd dev && xvfb-run tilt ci -- --test " + app +#@ params["CMD"] = "xvfb-run tilt --file dev/Tiltfile ci -- --test " + app name: #@ tilt_integration_test_name(app) serial: true plan: @@ -138,9 +138,6 @@ plan: - name: nix-host - name: #@ app_src_resource_name(app) path: #@ data.values.gh_repository + "-" + app - caches: - - path: cargo-home - - path: cargo-target-dir params: #@ params run: path: pipeline-tasks/ci/apps/tasks/run-on-nix-host.sh diff --git a/ci/apps/tasks/run-on-nix-host.sh b/ci/apps/tasks/run-on-nix-host.sh index fa6c4479fa..9eb5599c15 100755 --- a/ci/apps/tasks/run-on-nix-host.sh +++ b/ci/apps/tasks/run-on-nix-host.sh @@ -10,10 +10,10 @@ host_zone=$(cat nix-host/metadata | jq -r '.docker_host_zone') gcp_project=$(cat nix-host/metadata | jq -r '.docker_host_project') gcloud_ssh() { - gcloud compute ssh ${host_name} \ - --zone=${host_zone} \ - --project=${gcp_project} \ - --ssh-key-file=${CI_ROOT}/login.ssh \ + gcloud compute ssh "${host_name}" \ + --zone="${host_zone}" \ + --project="${gcp_project}" \ + --ssh-key-file="${CI_ROOT}/login.ssh" \ --tunnel-through-iap \ --command "$@" 2> /dev/null } @@ -30,16 +30,14 @@ ${SSH_PUB_KEY} EOF gcloud auth activate-service-account --key-file "${CI_ROOT}/gcloud-creds.json" 2> /dev/null -gcloud_ssh "docker ps -qa | xargs docker rm -fv || true; sudo rm -rf ${REPO_PATH} || true; mkdir -p ${REPO_PATH} && cd ${REPO_PATH}/../ && rmdir $(basename ${REPO_PATH})" +gcloud_ssh "docker ps -qa | xargs docker rm -fv || true; sudo rm -rf ${REPO_PATH} || true; mkdir -p ${REPO_PATH} && cd ${REPO_PATH}/../ && rmdir $(basename "${REPO_PATH}")" pushd "${REPO_PATH}" -[ -f .env.ci ] && envsubst < .env.ci > tmp.env.ci || true - -gcloud compute scp --ssh-key-file=${CI_ROOT}/login.ssh \ - --recurse $(pwd) ${host_name}:${REPO_PATH} \ +gcloud compute scp --ssh-key-file="${CI_ROOT}/login.ssh" \ + --recurse "$(pwd)" "${host_name}:${REPO_PATH}" \ --tunnel-through-iap \ - --zone=${host_zone} \ - --project=${gcp_project} > /dev/null + --zone="${host_zone}" \ + --project="${gcp_project}" > /dev/null gcloud_ssh "cd ${REPO_PATH}; nix develop -c ${CMD}" diff --git a/dev/Tiltfile b/dev/Tiltfile index 74a21e1bfc..efcedb9f2d 100644 --- a/dev/Tiltfile +++ b/dev/Tiltfile @@ -1,4 +1,4 @@ -is_ci=sys.argv[1] == "ci" +is_ci=("ci" in sys.argv) config.define_string_list("test") cfg = config.parse()