Skip to content

Commit

Permalink
debug quickstart scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
qrkourier committed Sep 23, 2024
1 parent 519a9a0 commit 3affb98
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release-quickstart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ jobs:
tags: ${{ steps.tagprep_qs.outputs.DOCKER_TAGS }}
build-args: |
ZITI_VERSION_OVERRIDE=${{ steps.get_version.outputs.ZITI_VERSION_OVERRIDE }}
GITHUB_OWNER=${GITHUB_OWNER}
GITHUB_REPO=${GITHUB_REPO}
push: true

- name: Configure Python
Expand Down
6 changes: 5 additions & 1 deletion quickstart/docker/image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ FROM ubuntu:rolling AS fetch-ziti-bins
# optional arg to specify which version to fetch when local "ziti-bin" directory is not present
ARG ZITI_VERSION_OVERRIDE
ARG DEBIAN_FRONTEND=noninteractive
ARG GITHUB_OWNER=openziti
ARG GITHUB_REPO=ziti
ENV GITHUB_OWNER=${GITHUB_OWNER}
ENV GITHUB_REPO=${GITHUB_REPO}

RUN apt-get update \
&& apt-get --yes install \
Expand Down Expand Up @@ -57,7 +61,7 @@ ENV ZITI_BIN_ROOT="${ZITI_BIN_DIR}"
ENV ZITI_SCRIPTS=/var/openziti/scripts

# copy the ziti binaries to a directory already on the path
COPY --chown=ziti --from=fetch-ziti-bins /ziti-bin "${ZITI_BIN_DIR}"
COPY --chown=ziti --from=fetch-ziti-bins /ziti-bin/ziti "${ZITI_BIN_DIR}"
COPY --chown=ziti ziti-cli-functions.sh "${ZITI_SCRIPTS}/"
COPY --chown=ziti run-controller.sh "${ZITI_SCRIPTS}/"
COPY --chown=ziti run-router.sh "${ZITI_SCRIPTS}/"
Expand Down
10 changes: 7 additions & 3 deletions quickstart/docker/image/fetch-ziti-bins.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
#!/bin/bash

set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace

# this script is executed during the docker build, after the build context has been copied to /docker.build.context

dest="${1}"
ZITI_BIN_DIR="${1}"

if [ -d /docker.build.context/ziti-bin ]; then
mv /docker.build.context/ziti-bin/ "${dest}"
mv /docker.build.context/ziti-bin/ "${ZITI_BIN_DIR}"
else
source /docker.build.context/ziti-cli-functions.sh
getZiti
mv "${ZITI_BIN_DIR}" "${dest}"
fi
11 changes: 4 additions & 7 deletions quickstart/docker/image/ziti-cli-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ function getZiti {
getLatestZitiVersion # sets ZITI_BINARIES_FILE & ZITI_BINARIES_VERSION
default_path="${ZITI_HOME}/ziti-bin/ziti-${ZITI_BINARIES_VERSION}"
echo -en "The path for ziti binaries has not been set, use the default (${default_path})? (Y/n) "
read -r reply
read -r reply || true
if [[ -z "${reply}" || ${reply} =~ [yY] ]]; then
echo "INFO: using the default path ${default_path}"
ZITI_BIN_DIR="${default_path}"
Expand All @@ -670,17 +670,14 @@ function getZiti {
return 1
fi
else
_check_env_variable ZITI_BINARIES_FILE ZITI_BINARIES_VERSION
retVal=$?
if [[ "${retVal}" != 0 ]]; then
return 1
fi

# Check if an error occurred while trying to pull desired version (happens with incorrect version or formatting issue)
if ! _verify_ziti_version_exists; then
echo -e " * $(RED "ERROR: The version of ziti requested (${ZITI_VERSION_OVERRIDE}) could not be found for OS (${ZITI_OSTYPE}) and architecture (${ZITI_ARCH}). Please check these details and try again. The version should follow the format \"vx.x.x\".") "
return 1
fi
if ! _check_env_variable ZITI_BINARIES_FILE ZITI_BINARIES_VERSION; then
return 1
fi
fi

# Where to store the ziti binaries zip
Expand Down

0 comments on commit 3affb98

Please sign in to comment.