@@ -30,7 +30,11 @@ The Angular template uses some global configuration used throughout all jobs.
You may configure [scoped registries](https://docs.npmjs.com/cli/v8/using-npm/scope#associating-a-scope-with-a-registry) with the `$NPM_CONFIG_SCOPED_REGISTRIES` variable.
The value is expected as a (whitespace-separated) list of `@registry_scope:registry_url`.
The Angular template also supports authentication tokens for each, simply by defining `NPM_REGISTRY_<SCOPE>_AUTH` (as project or group secret variables).
The Angular template also supports authentication for each, simply by defining the appropriate variable (as project or group secret variables)
:warning: The `<SCOPE>` part is the `registry_scope` transformed in [SCREAMING_SNAKE_CASE](https://en.wikipedia.org/wiki/Snake_case)(uppercase words separated by underscores).
@@ -39,7 +43,7 @@ Example: declare the GitLab chart repository from another GitLab project
if [[ "${reg_auth_token:-$reg_auth_token_legacy}" ]]
then
log_info " ... set auth token for scope \\e[33;1m${reg_scope}\\e[0m registry"
if [[ -z "$reg_auth_token" ]]; then
log_warn " ... auth token should be configured with \\e[33;1m\$NPM_REGISTRY_${reg_scope_ssc}_AUTH_TOKEN\\e[0m instead of \$NPM_REGISTRY_${reg_scope_ssc}_AUTH"
fi
npm config set "${reg_url_no_proto%/}/:_authToken" "${reg_auth_token:-$reg_auth_token_legacy}"
elif [[ "${reg_auth_basic}" ]]
then
log_info " ... set basic auth for scope \\e[33;1m${reg_scope}\\e[0m registry"
npm config set "${reg_url_no_proto%/}/:_auth" "${reg_auth_basic}"
fi
done
fi
}
function configure_gitlab_instance_level_npm_registry_auth() {
npm config set "//${CI_SERVER_HOST}/api/v4/packages/npm/:_authToken" "${CI_JOB_TOKEN}"