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
da193398
Commit
da193398
authored
7 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Move PyPI deployment to twine
parent
a47fdcb4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gitlab/deploy.sh
+3
-6
3 additions, 6 deletions
gitlab/deploy.sh
gitlab/functions.sh
+0
-86
0 additions, 86 deletions
gitlab/functions.sh
with
3 additions
and
92 deletions
gitlab/deploy.sh
+
3
−
6
View file @
da193398
#!/usr/bin/env bash
#!/usr/bin/env bash
#
Thu 22 Sep
201
6
1
3:59:03
CEST
#
Wed 11 Oct
201
7
1
5:00:21
CEST
source
$(
dirname
${
0
}
)
/functions.sh
source
$(
dirname
${
0
}
)
/functions.sh
...
@@ -15,12 +15,9 @@ if [ "${VISIBILITY}" != "public" ]; then
...
@@ -15,12 +15,9 @@ if [ "${VISIBILITY}" != "public" ]; then
exit
0
exit
0
fi
fi
lock_pypirc
log_info
"Uploading package to
${
PYPISERVER
}
on behalf of
${
PYPIUSER
}
..."
log_info
"Uploading package to
${
PYPISERVER
}
on behalf of
${
PYPIUSER
}
..."
setup_deploy check sdist
--formats
zip upload
--repository
production
twine register
--username
${
PYPIUSER
}
--password
${
PYPIPASS
}
dist/
*
.zip
twine upload
--username
${
PYPIUSER
}
--password
${
PYPIPASS
}
dist/
*
.zip
unlock_pypirc
condaforge_packages
=(
"bob"
\
condaforge_packages
=(
"bob"
\
"bob.buildout"
\
"bob.buildout"
\
...
...
This diff is collapsed.
Click to expand it.
gitlab/functions.sh
+
0
−
86
View file @
da193398
...
@@ -119,89 +119,6 @@ run_cmd() {
...
@@ -119,89 +119,6 @@ run_cmd() {
}
}
# Prepares ~/.pypirc
lock_pypirc
()
{
local
lockfile
=
/var/tmp/pypirc_lock
local
rc
=
${
HOME
}
/.pypirc
local
maxtries
=
10
local
try
=
0
local
sleeptime
=
30
#seconds
while
true
;
do
if
[[
${
try
}
-lt
${
maxtries
}
]]
;
then
((
try++
))
if
(
set
-o
noclobber
;
echo
"
$$
"
>
"
${
lockfile
}
"
)
2> /dev/null
;
then
log_info
"Successfully acquired
${
lockfile
}
"
echo
$$
>
${
lockfile
}
log_info
"trapping on
${
lockfile
}
..."
trap
'rm -f "${lockfile}"; exit $?'
INT TERM EXIT
# start: protected code
log_info
"Creating
${
rc
}
..."
if
[
-e
${
rc
}
]
;
then
run_cmd
rm
-f
${
rc
}
fi
cat
<<
EOT
>>
${
rc
}
[distutils]
index-servers =
production
staging
[production]
username:
${
PYPIUSER
}
password:
${
PYPIPASS
}
[staging]
repository:
${
TESTSERVER
}
username:
${
PYPIUSER
}
password:
${
PYPIPASS
}
EOT
run_cmd
chmod
600
${
rc
}
# end: protected code
break
else
log_warn
"
${
lockfile
}
exists, owned by process
$(
cat
$lockfile
)
"
log_info
"Will retry after a
${
sleeptime
}
seconds sleep (
${
try
}
/
${
maxtries
}
)"
run_cmd
sleep
${
sleeptime
}
fi
else
log_error
"I already retried deploying
${
try
}
times. Aborting..."
log_error
"You can retry this step when less packages are building."
exit
1
fi
done
}
# Cleans ~/.pypirc, if the lock file belongs to us
unlock_pypirc
()
{
local
lockfile
=
/var/tmp/pypirc_lock
local
rc
=
${
HOME
}
/.pypirc
# untrap if lock belongs to the running process
if
[[
$(
cat
${
lockfile
}
)
==
$$
]]
;
then
run_cmd
rm
-r
${
lockfile
}
run_cmd
rm
-rf
${
rc
}
log_info
"
$
trap - INT TERM EXIT"
trap
- INT TERM EXIT
fi
}
# Runs setup.py in a deployment context. If fails, tries to unlock
# the ${HOME}/.pypirc file lock
setup_deploy
()
{
log_info
"
$
${
@
}
"
${
PREFIX
}
/bin/python setup.py
${
@
}
local
status
=
$?
if
[
${
status
}
!=
0
]
;
then
log_error
"Command Failed
\"
${
@
}
\"
"
unlock_pypirc
#just tries
exit
${
status
}
fi
}
# Uploads a file to our intranet location via curl
# Uploads a file to our intranet location via curl
# $1: Path to the file to upload (e.g. dist/myfile.whl)
# $1: Path to the file to upload (e.g. dist/myfile.whl)
# $2: Path on the server to upload to (e.g. private-upload/wheels/gitlab/)
# $2: Path on the server to upload to (e.g. private-upload/wheels/gitlab/)
...
@@ -414,8 +331,6 @@ if [ -z "${PREFIX}" ]; then
...
@@ -414,8 +331,6 @@ if [ -z "${PREFIX}" ]; then
PREFIX
=
${
CI_PROJECT_DIR
}
/build-prefix
PREFIX
=
${
CI_PROJECT_DIR
}
/build-prefix
fi
fi
TESTSERVER
=
https://testpypi.python.org/legacy/
check_env OSNAME
check_env OSNAME
check_env VISIBILITY
check_env VISIBILITY
check_env IS_MASTER
check_env IS_MASTER
...
@@ -423,7 +338,6 @@ check_env PYVER
...
@@ -423,7 +338,6 @@ check_env PYVER
check_env PREFIX
check_env PREFIX
export_env PREFIX
export_env PREFIX
check_env DOCSERVER
check_env DOCSERVER
check_env TESTSERVER
check_env CONDA_FOLDER
check_env CONDA_FOLDER
check_env CONDA_ENV
check_env CONDA_ENV
export_env BOB_PREFIX_PATH
export_env BOB_PREFIX_PATH
...
...
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