-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetsecret.cmd
More file actions
40 lines (33 loc) · 1.03 KB
/
setsecret.cmd
File metadata and controls
40 lines (33 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@echo off
setlocal ENABLEDELAYEDEXPANSION
REM --- Get the OpenShift token ---
oc whoami --show-token > openshift.login.token
set /P TOKEN=< openshift.login.token
del openshift.login.token
REM --- Get the OpenShift server ---
oc whoami --show-server > openshift.server
set /P SERVER=< openshift.server
del openshift.server
REM Remove quotes if present
set TOKEN=%TOKEN:"=%
set SERVER=%SERVER:"=%
REM --- Set required GitHub Secrets ---
gh secret set OPENSHIFT_SERVER -b "%SERVER%"
gh secret set OPENSHIFT_TOKEN -b "%TOKEN%"
REM --- Validate Registry Username ---
IF "%MY_REGISTRY_USERNAME%"=="" (
echo ERROR: No MY_REGISTRY_USERNAME set. Please set MY_REGISTRY_USERNAME first.
goto end
) ELSE (
gh secret set IMAGE_REGISTRY_USER -b "%MY_REGISTRY_USERNAME%"
)
REM --- Validate Registry Password ---
IF "%MY_REGISTRY_PASSWORD%"=="" (
echo ERROR: No MY_REGISTRY_PASSWORD set. Please set MY_REGISTRY_PASSWORD first.
goto end
) ELSE (
gh secret set IMAGE_REGISTRY_PASSWORD -b "%MY_REGISTRY_PASSWORD%"
)
:end
echo Done.
endlocal