Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Main Repositories
otb
Commits
1624d75e
Commit
1624d75e
authored
Jun 26, 2019
by
Guillaume Pasero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CI: make API token optional
parent
1ecafba8
Pipeline
#2012
passed with stage
in 8 minutes and 56 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
CI/cdash_handler.py
CI/cdash_handler.py
+8
-4
CI/check_twin_pipelines.py
CI/check_twin_pipelines.py
+4
-3
No files found.
CI/cdash_handler.py
View file @
1624d75e
...
...
@@ -302,16 +302,19 @@ if __name__ == "__main__":
token
=
sys
.
argv
[
4
]
refn
=
sys
.
argv
[
5
]
else
:
if
not
CheckEnvParameters
([
'CI_COMMIT_SHA'
,
'CI_PROJECT_ID'
,
'CI_PROJECT_DIR'
,
'K8S_SECRET_API_TOKEN'
,
'CI_COMMIT_REF_NAME'
]):
if
not
CheckEnvParameters
([
'CI_COMMIT_SHA'
,
'CI_PROJECT_ID'
,
'CI_PROJECT_DIR'
,
'CI_COMMIT_REF_NAME'
]):
sys
.
exit
(
1
)
sha1
=
os
.
environ
[
'CI_COMMIT_SHA'
]
proj
=
os
.
environ
[
'CI_PROJECT_ID'
]
pdir
=
os
.
environ
[
'CI_PROJECT_DIR'
]
token
=
os
.
environ
[
'K8S_SECRET_API_TOKEN'
]
if
'CI_MERGE_REQUEST_REF_PATH'
in
os
.
environ
.
keys
():
refn
=
os
.
environ
[
'CI_MERGE_REQUEST_REF_PATH'
]
else
:
refn
=
os
.
environ
[
'CI_COMMIT_REF_NAME'
]
if
CheckEnvParameters
([
'K8S_SECRET_API_TOKEN'
]):
token
=
os
.
environ
[
'K8S_SECRET_API_TOKEN'
]
else
:
token
=
None
handler
=
Handler
()
build_dir
=
os
.
path
.
join
(
pdir
,
"build/"
)
if
trace
:
...
...
@@ -327,8 +330,9 @@ if __name__ == "__main__":
else
:
cdash_url
=
handler
.
GetBuildUrl
()
(
state
,
error
)
=
handler
.
GetLogStatus
(
os
.
path
.
join
(
pdir
,
"log"
)
)
if
trace
:
print
(
"cdash_url is: "
+
cdash_url
)
print
(
"CDash build URL : "
+
cdash_url
)
if
token
is
None
:
sys
.
exit
(
0
)
gitlab_url
=
"https://gitlab.orfeo-toolbox.org/api/v4/projects/"
gitlab_url
+=
proj
+
"/statuses/"
+
sha1
params
=
urllib
.
parse
.
urlencode
({
'name'
:
'cdash:'
+
handler
.
site
,
'state'
:
state
,
\
...
...
CI/check_twin_pipelines.py
View file @
1624d75e
...
...
@@ -65,9 +65,10 @@ if __name__ == "__main__":
# are we in a merge_request pipeline ?
if
'CI_MERGE_REQUEST_IID'
in
env
.
keys
():
if
not
CheckEnvParameters
([
'K8S_SECRET_API_TOKEN'
]):
print
(
"Make sure you have set a valid acces token for Gitlab API"
)
print
(
"The K8S_SECRET_API_TOKEN environment variable should be set in 'Settings -> CI/CD -> Variables'"
)
sys
.
exit
(
1
)
print
(
"WARNING: Make sure you have set a valid acces token for Gitlab API."
\
+
"The K8S_SECRET_API_TOKEN environment variable should be set in 'Settings -> CI/CD -> Variables'"
\
+
"Without this token, some feature of the CI platform will be disabled."
)
sys
.
exit
(
0
)
if
not
CheckEnvParameters
([
'CI_PROJECT_ID'
,
'CI_PIPELINE_ID'
]):
sys
.
exit
(
1
)
mrInfo
=
GitlabRequest
(
'merge_requests/'
+
env
[
'CI_MERGE_REQUEST_IID'
],
token
=
env
[
'K8S_SECRET_API_TOKEN'
])
...
...
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