-
Notifications
You must be signed in to change notification settings - Fork 20
feat: add check for empty htpasswd file and user login creation #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
823e4dd
aa3dcdd
4e2a63a
eed87b7
4560fee
e18cf8b
0b1e019
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| ERR_APT_INSTALL_TIMEOUT=9 # Timeout installing required apt packages | ||
| ERR_MISSING_CRT_FILE=10 # Bad cert thumbprint OR pfx not in key vault OR template misconfigured VM secrets section | ||
| ERR_MISSING_KEY_FILE=11 # Bad cert thumbprint OR pfx not in key vault OR template misconfigured VM secrets section | ||
| ERR_MISSING_USER_CREDENTIALS=12 # No user credentials secret found on given key vault | ||
| ERR_REGISTRY_NOT_RUNNING=13 # The container registry failed to start successfully | ||
| ERR_MOBY_APT_LIST_TIMEOUT=25 # Timeout waiting for moby apt sources | ||
| ERR_MS_GPG_KEY_DOWNLOAD_TIMEOUT=26 # Timeout waiting for MS GPG key download | ||
|
|
@@ -126,6 +127,11 @@ fetchCredentials() { | |
| "${secret}?api-version=2016-10-01" -H "Authorization: Bearer ${TOKEN}" | jq -r .value) | ||
| htpasswd -Bb .htpasswd ${SECRET_NAME} ${SECRET_VALUE} | ||
| done | ||
|
|
||
| if [ ! -s .htpasswd ]; then | ||
| echo ".htpasswd file is empty." | ||
| return $ERR_MISSING_USER_CREDENTIALS | ||
| fi | ||
| } | ||
| fetchStorageKeys() { | ||
| RESOURCE=$(jq -r .authentication.audiences[0] ${ENDPOINTS}) | ||
|
|
@@ -205,6 +211,11 @@ echo fetching user credentials | |
| HTPASSWD_DIR="/root/auth" | ||
| mkdir -p $HTPASSWD_DIR | ||
| fetchCredentials | ||
| returnCode=$? | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jadarsie Updated the code a bit here again as non zero return code was not failing the deployment. Above changes will address both cases (current failure and any future non zero error code). Let me know if you feel otherwise.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, I missed it, it should be |
||
| if [[ $returnCode != 0 ]]; then | ||
| exit $returnCode | ||
| fi | ||
|
|
||
| cp .htpasswd $HTPASSWD_DIR/.htpasswd | ||
|
|
||
| echo starting registry container | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.