@@ -8,19 +8,21 @@ C_R='\033[0;31m' # color red
8
8
C_Y=' \033[0;33m' # color yellow
9
9
C_Cy=' \033[0;36m' # color cyan
10
10
11
- REGISTRY=" "
12
- TLS_VERIFY=" false"
13
- ALIAS_TAGS=" "
14
- DRY_RUN=" false"
15
- PUBLISH=" false"
16
- ANNOTATION_CONF=" ./containers/annotation.conf"
17
-
18
- while getopts " hdtp:a:c:" opt; do
11
+ REGISTRY=" " ;
12
+ TLS_VERIFY=" false" ;
13
+ ALIAS_TAGS=" " ;
14
+ DRY_RUN=" false" ;
15
+ PUBLISH=" false" ;
16
+ ANNOTATION_CONF=" ./containers/annotation.conf" ;
17
+ USER_NAME=" " ;
18
+ USER_PASS=" " ;
19
+
20
+ while getopts " hdtu:p:a:c:r:" opt; do
19
21
case $opt in
20
22
" d" )
21
23
DRY_RUN=" true" ;
22
24
;;
23
- " p " )
25
+ " r " )
24
26
PUBLISH=" true" ;
25
27
REGISTRY=" ${OPTARG} " ;
26
28
if [[ -z " $REGISTRY " ]]; then
@@ -31,6 +33,12 @@ while getopts "hdtp:a:c:" opt; do
31
33
" t" )
32
34
TLS_VERIFY=" true" ;
33
35
;;
36
+ " u" )
37
+ USER_NAME=" ${OPTARG} " ;
38
+ ;;
39
+ " p" )
40
+ USER_PASS=" ${OPTARG} " ;
41
+ ;;
34
42
" a" )
35
43
ALIAS_TAGS=" ${OPTARG} " ;
36
44
;;
@@ -43,13 +51,15 @@ while getopts "hdtp:a:c:" opt; do
43
51
fi
44
52
;;
45
53
" h" )
46
- printf " Usage %s: [-h] [-d] [-p registry] [-t] [-a alias-tags].\n" $0
54
+ printf " Usage %s: [-h] [-d] [-r registry] [-t] [-a alias-tags] [-l username] [-p password ].\n" $0
47
55
echo " Arguments:"
48
56
echo " -h : Help menu."
49
57
echo " -d : Dry-run. Only prints messages."
50
- echo " -p <registry-url> : Pushes images and manifest to the target registry."
58
+ echo " -r <registry-url> : Pushes images and manifest to the target registry."
51
59
echo " -t : Enable TLS verification. Default is false."
52
- echo " -a <tag1;tag2;...> : Additional alias tags separeted with semicolons (;)"
60
+ echo " -a <tag1 tag2 ...> : Additional alias tags separated with spaces"
61
+ echo " -u <username> : Registry username to login"
62
+ echo " -p <password> : User password"
53
63
exit 2;
54
64
;;
55
65
? )
@@ -171,7 +181,7 @@ done;
171
181
172
182
if [[ " $PUBLISH " == " true" ]]; then
173
183
test " ${DRY_RUN} " ! = " true" && \
174
- buildah login --tls-verify=" ${TLS_VERIFY} " " ${REGISTRY} "
184
+ buildah login --tls-verify=" ${TLS_VERIFY} " -u " ${USER_NAME} " -p " ${USER_PASS} " " ${ REGISTRY}" ;
175
185
176
186
TAG_LIST=(" ${VERSION} " ${ALIAS_TAGS[@]} );
177
187
for TAG in " ${TAG_LIST[@]} " ;
0 commit comments