Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Setup-Manager
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Dmytro Bogatov
Setup-Manager
Commits
1d686941
Verified
Commit
1d686941
authored
Nov 29, 2018
by
Dmytro Bogatov
💕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic auth to docker image.
parent
1cd7b68e
Pipeline
#3103
passed with stages
in 49 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
2 deletions
+16
-2
docker/generate-review-app.sh
docker/generate-review-app.sh
+13
-2
docker/service/ingress.yaml
docker/service/ingress.yaml
+3
-0
No files found.
docker/generate-review-app.sh
View file @
1d686941
...
...
@@ -7,12 +7,12 @@ cd "${0%/*}"
CWD
=
$(
pwd
)
usage
()
{
printf
"usage:
$0
<name> <image> <url>
\n
"
printf
"usage:
$0
<name> <image> <url>
<auth-password>
\n
"
exit
1
;
}
if
!
[
$#
-eq
3
]
if
!
[
$#
-eq
4
]
then
usage
fi
...
...
@@ -20,6 +20,9 @@ fi
NAME
=
$1
IMAGE
=
$2
URL
=
$3
AUTHPASS
=
$4
AUTH
=
""
echo
"Generating
$NAME
configs..."
...
...
@@ -37,8 +40,16 @@ digest="${digest%\"}"
digest=
"
${
digest
#\
"}"
IMAGE=
${
IMAGE
%
:
*
}
@
$digest
if [
"
$AUTHPASS
"
!=
""
]
then
AUTH=
"nginx.ingress.kubernetes.io/auth-type: basic"
fi
htpasswd -b -c ./out/auth review
$AUTHPASS
sed -i -e
"s#__IMAGE__#
$IMAGE
#g"
./out/{service,deployment,ingress
}
.yaml
sed -i -e "
s
#__NAME__#
$NAME
#g
" ./out/{service,deployment,ingress}.yaml
sed -i -e "
s
#__URL__#
$URL
#g
" ./out/{service,deployment,ingress}.yaml
sed -i -e "
s
#__AUTH__#
$AUTH
#g
" ./out/{service,deployment,ingress}.yaml
rm -rf ./out/*-e
docker/service/ingress.yaml
View file @
1d686941
...
...
@@ -7,6 +7,9 @@ metadata:
kubernetes.io/ingress.class
:
"
public"
nginx.ingress.kubernetes.io/force-ssl-redirect
:
"
true"
nginx.ingress.kubernetes.io/ssl-redirect
:
"
true"
nginx.ingress.kubernetes.io/auth-secret
:
__NAME__-basic-auth
nginx.singress.kubernetes.io/auth-realm
:
"
The
username
is
'review'
(without
quotes)
and
the
password
is
.gitlab-ci.yml
file
on
the
top
in
variable
AUTHPASSWORD."
__AUTH__
spec
:
tls
:
-
secretName
:
lets-encrypt
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment