Skip to content

Commit

Permalink
chore: improve passing environment variables to the container
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwn committed Oct 17, 2023
1 parent 3ecf4b0 commit 48e44d2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions scripts/release_scripts/run_macaron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,10 @@ if [[ -f "$HOME/.m2/settings.xml" ]]; then
fi

# Set up proxy.
# We respect the host machine's proxy environment variables.
# For Maven and Gradle projects that Macaron needs to analyzes, the proxy configuration
# for Maven wrapper `mvnw` and Gradle wrapper `gradlew` are set using `MAVEN_OPTS` and
# - We respect the host machine's proxy environment variables.
# - For Maven, proxy configuration can be set through the `MAVEN_OPTS`
# environment variable.
# - For Gradle, proxy configuration can be set through the `JAVA_OPTS` or
# `GRADLE_OPTS` environment variables.
proxy_var_names=(
"http_proxy"
Expand All @@ -365,11 +366,12 @@ proxy_var_names=(
"FTP_PROXY"
"NO_PROXY"
"MAVEN_OPTS"
"JAVA_OPTS"
"GRADLE_OPTS"
)

for v in "${proxy_var_names[@]}"; do
[[ -n ${!v:-} ]] && proxy_vars+=("-e" "${v}=${!v}")
proxy_vars+=("-e" "${v}")
done

prod_vars=(
Expand Down Expand Up @@ -434,9 +436,9 @@ ${DOCKER_EXEC} run \
--rm -i "${tty[@]}" \
-e "USER_UID=${USER_UID}" \
-e "USER_GID=${USER_GID}" \
-e "GITHUB_TOKEN=${GITHUB_TOKEN:-}" \
-e "MCN_GITLAB_TOKEN=${MCN_GITLAB_TOKEN:-}" \
-e "MCN_SELF_HOSTED_GITLAB_TOKEN=${MCN_SELF_HOSTED_GITLAB_TOKEN:-}" \
-e "GITHUB_TOKEN" \
-e "MCN_GITLAB_TOKEN" \
-e "MCN_SELF_HOSTED_GITLAB_TOKEN" \
"${proxy_vars[@]}" \
"${prod_vars[@]}" \
"${mounts[@]}" \
Expand Down

0 comments on commit 48e44d2

Please sign in to comment.