Skip to content

Commit

Permalink
ci: get Tilt working in concourse
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymindarts committed Oct 27, 2023
1 parent 72813cb commit 3ce2b86
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tilt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
5 changes: 1 addition & 4 deletions ci/apps/app-template.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
20 changes: 9 additions & 11 deletions ci/apps/tasks/run-on-nix-host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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}"
2 changes: 1 addition & 1 deletion dev/Tiltfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
is_ci=sys.argv[1] == "ci"
is_ci=("ci" in sys.argv)

config.define_string_list("test")
cfg = config.parse()
Expand Down

0 comments on commit 3ce2b86

Please sign in to comment.