Skip to content

Commit

Permalink
Merge pull request #106 from felddy/improvement/hybrid_auth
Browse files Browse the repository at this point in the history
Always authenticate when credentials are provided
  • Loading branch information
felddy authored Nov 2, 2020
2 parents 559a5f6 + d97f407 commit c5ba3a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ jobs:
build-push-all:
name: "Build and push all platforms"
runs-on: ubuntu-latest
needs: [prepare, test-normal, test-pre-install]
needs: [lint, prepare, test-normal, test-pre-install]
if: github.event_name != 'pull_request'
steps:
- name: Login to DockerHub
Expand Down
16 changes: 12 additions & 4 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,21 @@ if [ $install_required = true ]; then
if [ "${FOUNDRY_RELEASE_URL:-}" ]; then
log "Using FOUNDRY_RELEASE_URL to download release."
s3_url="${FOUNDRY_RELEASE_URL}"
elif [[ "${FOUNDRY_USERNAME:-}" && "${FOUNDRY_PASSWORD:-}" ]]; then
fi
if [[ "${FOUNDRY_USERNAME:-}" && "${FOUNDRY_PASSWORD:-}" ]]; then
log "Using FOUNDRY_USERNAME and FOUNDRY_PASSWORD to authenticate."
# If credentials are provided attempt authentication.
# The resulting cookiejar is used to get a release URL or license.
# CONTAINER_VERBOSE default value should not be quoted.
# shellcheck disable=SC2086
./authenticate.js ${CONTAINER_VERBOSE+--log-level=debug} "${FOUNDRY_USERNAME}" "${FOUNDRY_PASSWORD}" "${cookiejar_file}"
# shellcheck disable=SC2086
s3_url=$(./get_release_url.js ${CONTAINER_VERBOSE+--log-level=debug} "${cookiejar_file}" "${FOUNDRY_VERSION}")
if [[ ! "${s3_url:-}" ]]; then
# If the s3_url wasn't set by FOUNDRY_RELEASE_URL generate one now.
log "Using authenticated credentials to download release."
# CONTAINER_VERBOSE default value should not be quoted.
# shellcheck disable=SC2086
s3_url=$(./get_release_url.js ${CONTAINER_VERBOSE+--log-level=debug} "${cookiejar_file}" "${FOUNDRY_VERSION}")
fi
fi

if [[ "${CONTAINER_CACHE:-}" ]]; then
Expand Down Expand Up @@ -183,7 +191,7 @@ if [ ! -f /data/Config/license.json ]; then
fi
echo "{ \"license\": \"${fetched_license_key}\" }" > /data/Config/license.json
else
log_warn "Unable to apply a license key since niether a license key nor credentials were provided. The license key will need to be entered in the browser."
log_warn "Unable to apply a license key since neither a license key nor credentials were provided. The license key will need to be entered in the browser."
fi
set -o nounset
else
Expand Down

0 comments on commit c5ba3a4

Please sign in to comment.