Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.admin
Commits
5813e43a
Commit
5813e43a
authored
7 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Import doc functions here; Set new environment variable names for CI
parent
47bea731
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gitlab/functions.sh
+54
-6
54 additions, 6 deletions
gitlab/functions.sh
with
54 additions
and
6 deletions
gitlab/functions.sh
+
54
−
6
View file @
5813e43a
...
...
@@ -17,6 +17,26 @@ visibility() {
}
# Determines if we're on the master branch or not
is_master
()
{
local
retval
=
"
${
CI_COMMIT_REF_NAME
}
"
if
[[
-n
"
${
CI_COMMIT_TAG
}
"
]]
;
then
# we're building a tag, check it is available on the master branch
local
count
=
`
git branch
-a
--contains
"tags/
${
CI_COMMIT_TAG
}
"
|
grep
master |
wc
-l
`
if
[[
"
${
count
}
"
-gt
"0"
]]
;
then
#tag is on master
retval
=
"master"
else
retval
=
"it-is-not-master"
fi
fi
if
[[
"
${
retval
}
"
==
"master"
]]
;
then
return
"true"
else
return
"false"
fi
}
# Functions for coloring echo commands
log_debug
()
{
echo
-e
"(
`
date
+%T
`
)
\0
33[1;32m
${
@
}
\0
33[0m"
...
...
@@ -313,8 +333,7 @@ check_env CI_PROJECT_URL
check_env CI_PROJECT_DIR
check_env CI_PROJECT_PATH
check_env CI_PROJECT_NAME
check_env CI_BUILD_REF
check_env CI_BUILD_REF_NAME
check_env CI_COMMIT_REF_NAME
check_pass PYPIUSER
check_pass PYPIPASS
check_pass DOCUSER
...
...
@@ -323,6 +342,7 @@ check_pass DOCPASS
# Sets up variables
OSNAME
=
`
osname
`
VISIBILITY
=
`
visibility
`
IS_MASTER
=
`
is_master
`
if
[
-z
"
${
CONDA_FOLDER
}
"
]
;
then
CONDA_FOLDER
=
/opt/conda
...
...
@@ -330,8 +350,8 @@ fi
PYVER
=
py
$(
echo
${
PYTHON_VERSION
}
|
tr
-d
'.'
)
if
[
-z
"
${
CONDA_ENV
}
"
]
;
then
if
[
-d
"
${
CONDA_FOLDER
}
/envs/bob-devel-
${
PYVER
}
-
${
CI_
BUILD
_REF_NAME
}
"
]
;
then
CONDA_ENV
=
bob-devel-
${
PYVER
}
-
${
CI_
BUILD
_REF_NAME
}
if
[
-d
"
${
CONDA_FOLDER
}
/envs/bob-devel-
${
PYVER
}
-
${
CI_
COMMIT
_REF_NAME
}
"
]
;
then
CONDA_ENV
=
bob-devel-
${
PYVER
}
-
${
CI_
COMMIT
_REF_NAME
}
else
CONDA_ENV
=
bob-devel-
${
PYVER
}
fi
...
...
@@ -355,6 +375,7 @@ TESTSERVER=https://testpypi.python.org/pypi
check_env OSNAME
check_env VISIBILITY
check_env IS_MASTER
check_env PYVER
check_env PREFIX
export_env PREFIX
...
...
@@ -366,7 +387,7 @@ check_env CONDA_ENV
export_env BOB_PREFIX_PATH
# Setup default documentation server
if
[
-z
"
${
CI_
BUILD
_TAG
}
"
]
;
then
if
[
-z
"
${
CI_
COMMIT
_TAG
}
"
]
;
then
DEFSRV
=
"
${
DOCSERVER
}
/software/bob/docs/latest/bob/%s/master/"
else
DEFSRV
=
"http://pythonhosted.org/%s/"
...
...
@@ -383,8 +404,35 @@ fi
unset
DEFSRV
export_env BOB_DOCUMENTATION_SERVER
#
s
ets up certificates for curl and openssl
#
S
ets up certificates for curl and openssl
CURL_CA_BUNDLE
=
"
${
SCRIPTS_DIR
}
/cacert.pem"
export_env CURL_CA_BUNDLE
SSL_CERT_FILE
=
"
${
CURL_CA_BUNDLE
}
"
export_env SSL_CERT_FILE
# Sets up upload folders for documentation (just in case we need them)
# See: https://gitlab.idiap.ch/bob/bob.admin/issues/2
# Prefix differs between private & public repos
DOC_SERVER_PREFIX
=
"-upload/
${
CI_PROJECT_PATH
}
/docs"
if
[[
"
${
VISIBILITY
}
"
==
"public"
]]
;
then
DOCS_SERVER_PREFIX
=
"public
${
DOCS_SERVER_PREFIX
}
else
DOCS_SERVER_PREFIX="
private
${
DOCS_SERVER_PREFIX
}
fi
DOC_UPLOADS
=()
if
[[
"
${
IS_MASTER
}
== "
true
" ]]; then
DOC_UPLOADS+=("
$DOCS_SERVER_PREFIX
/master/
")
fi
if [[ -n "
${
CI_COMMIT_TAG
}
" ]]; then
DOC_UPLOADS+=("
$DOCS_SERVER_PREFIX
/
$CI_COMMIT_TAG
/
")
fi
if [[ -n "
${
CI_COMMIT_TAG
}
" && "
${
IS_MASTER
}
" == "
true
" ]]; then
DOC_UPLOADS+=("
$DOCS_SERVER_PREFIX
/stable/
")
fi
unset DOCS_SERVER_PREFIX
check_env DOC_UPLOADS
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment