Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.devtools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Show more breadcrumbs
bob
bob.devtools
Commits
283fb134
Commit
283fb134
authored
6 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[scripts][ci] Handle rebuilt artefacts properly
parent
41cdca39
No related branches found
No related tags found
No related merge requests found
Pipeline
#27669
passed
6 years ago
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bob/devtools/build.py
+1
-1
1 addition, 1 deletion
bob/devtools/build.py
bob/devtools/scripts/ci.py
+46
-4
46 additions, 4 deletions
bob/devtools/scripts/ci.py
bob/devtools/scripts/rebuild.py
+13
-3
13 additions, 3 deletions
bob/devtools/scripts/rebuild.py
with
60 additions
and
8 deletions
bob/devtools/build.py
+
1
−
1
View file @
283fb134
...
@@ -139,7 +139,7 @@ def make_conda_config(config, python, append_file, condarc_options):
...
@@ -139,7 +139,7 @@ def make_conda_config(config, python, append_file, condarc_options):
def
get_output_path
(
metadata
,
config
):
def
get_output_path
(
metadata
,
config
):
'''
Renders the recipe and returns the
interpreted YAML
file
'''
'''
Renders the recipe and returns the
name of the output
file
'''
from
conda_build.api
import
get_output_file_paths
from
conda_build.api
import
get_output_file_paths
return
get_output_file_paths
(
metadata
,
config
=
config
)[
0
]
return
get_output_file_paths
(
metadata
,
config
=
config
)[
0
]
...
...
This diff is collapsed.
Click to expand it.
bob/devtools/scripts/ci.py
+
46
−
4
View file @
283fb134
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
os
import
os
import
re
import
re
import
glob
import
glob
import
shutil
import
yaml
import
yaml
import
click
import
click
...
@@ -11,7 +12,8 @@ import conda_build.api
...
@@ -11,7 +12,8 @@ import conda_build.api
from
click_plugins
import
with_plugins
from
click_plugins
import
with_plugins
from
.
import
bdt
from
.
import
bdt
from
..constants
import
SERVER
,
CONDA_BUILD_CONFIG
,
CONDA_RECIPE_APPEND
from
..constants
import
SERVER
,
CONDA_BUILD_CONFIG
,
CONDA_RECIPE_APPEND
,
\
WEBDAV_PATHS
from
..log
import
verbosity_option
,
get_logger
,
echo_normal
from
..log
import
verbosity_option
,
get_logger
,
echo_normal
logger
=
get_logger
(
__name__
)
logger
=
get_logger
(
__name__
)
...
@@ -57,7 +59,6 @@ def base_deploy(dry_run):
...
@@ -57,7 +59,6 @@ def base_deploy(dry_run):
package
=
os
.
environ
[
'
CI_PROJECT_PATH
'
]
package
=
os
.
environ
[
'
CI_PROJECT_PATH
'
]
from
..constants
import
WEBDAV_PATHS
server_info
=
WEBDAV_PATHS
[
True
][
True
]
#stable=True, visible=True
server_info
=
WEBDAV_PATHS
[
True
][
True
]
#stable=True, visible=True
logger
.
info
(
'
Deploying dependence packages to %s%s%s...
'
,
SERVER
,
logger
.
info
(
'
Deploying dependence packages to %s%s%s...
'
,
SERVER
,
...
@@ -138,7 +139,6 @@ def deploy(dry_run):
...
@@ -138,7 +139,6 @@ def deploy(dry_run):
# determine if building branch or tag
# determine if building branch or tag
stable
=
(
'
CI_COMMIT_TAG
'
in
os
.
environ
)
stable
=
(
'
CI_COMMIT_TAG
'
in
os
.
environ
)
from
..constants
import
WEBDAV_PATHS
server_info
=
WEBDAV_PATHS
[
stable
][
visible
]
server_info
=
WEBDAV_PATHS
[
stable
][
visible
]
logger
.
info
(
'
Deploying conda packages to %s%s%s...
'
,
SERVER
,
logger
.
info
(
'
Deploying conda packages to %s%s%s...
'
,
SERVER
,
...
@@ -564,6 +564,7 @@ def nightlies(ctx, order, dry_run):
...
@@ -564,6 +564,7 @@ def nightlies(ctx, order, dry_run):
# determine package visibility
# determine package visibility
private
=
urlopen
(
'
https://gitlab.idiap.ch/%s
'
%
package
).
getcode
()
!=
200
private
=
urlopen
(
'
https://gitlab.idiap.ch/%s
'
%
package
).
getcode
()
!=
200
stable
=
'
STABLE
'
in
os
.
environ
ctx
.
invoke
(
rebuild
,
ctx
.
invoke
(
rebuild
,
recipe_dir
=
[
os
.
path
.
join
(
clone_to
,
'
conda
'
)],
recipe_dir
=
[
os
.
path
.
join
(
clone_to
,
'
conda
'
)],
...
@@ -574,7 +575,48 @@ def nightlies(ctx, order, dry_run):
...
@@ -574,7 +575,48 @@ def nightlies(ctx, order, dry_run):
server
=
SERVER
,
server
=
SERVER
,
group
=
group
,
group
=
group
,
private
=
private
,
private
=
private
,
stable
=
'
STABLE
'
in
os
.
environ
,
stable
=
stable
,
dry_run
=
dry_run
,
dry_run
=
dry_run
,
ci
=
True
,
ci
=
True
,
)
)
sphinx_output
=
os
.
path
.
join
(
os
.
environ
[
'
CI_PROJECT_DIR
'
],
'
sphinx
'
)
if
os
.
path
.
exists
(
sphinx_output
):
logger
.
debug
(
'
Sphinx output was generated during test/rebuild of %s -
'
\
'
Erasing...
'
,
package
)
shutil
.
rmtree
(
sphinx_output
)
# re-deploys a new conda package if it was rebuilt
# n.b.: can only arrive here if dry_run was ``False`` (no need to check
# again)
if
'
BDT_REBUILD
'
in
os
.
environ
:
tarball
=
os
.
environ
[
'
BDT_REBUILD
'
]
del
os
.
environ
[
'
BDT_REBUILD
'
]
server_info
=
WEBDAV_PATHS
[
stable
][
not
private
]
logger
.
info
(
'
Deploying conda package to %s%s%s...
'
,
SERVER
,
server_info
[
'
root
'
],
server_info
[
'
conda
'
])
# setup webdav connection
webdav_options
=
{
'
webdav_hostname
'
:
SERVER
,
'
webdav_root
'
:
server_info
[
'
root
'
],
'
webdav_login
'
:
os
.
environ
[
'
DOCUSER
'
],
'
webdav_password
'
:
os
.
environ
[
'
DOCPASS
'
],
}
from
..webdav3
import
client
as
webdav
davclient
=
webdav
.
Client
(
webdav_options
)
assert
davclient
.
valid
()
remote_path
=
'
%s/%s/%s
'
%
(
server_info
[
'
conda
'
],
arch
,
os
.
path
.
basename
(
tarball
))
if
davclient
.
check
(
remote_path
):
raise
RuntimeError
(
'
The file %s/%s already exists on the server
'
\
'
- this can be due to more than one rebuild with deployment
'
\
'
running at the same time. Re-running the broken builds
'
\
'
normally fixes it
'
%
(
SERVER
,
remote_path
))
logger
.
info
(
'
[dav] %s -> %s%s%s
'
,
k
,
SERVER
,
server_info
[
'
root
'
],
remote_path
)
davclient
.
upload
(
local_path
=
tarball
,
remote_path
=
remote_path
)
This diff is collapsed.
Click to expand it.
bob/devtools/scripts/rebuild.py
+
13
−
3
View file @
283fb134
...
@@ -175,7 +175,7 @@ def rebuild(recipe_dir, python, condarc, config, append_file,
...
@@ -175,7 +175,7 @@ def rebuild(recipe_dir, python, condarc, config, append_file,
if
should_build
:
#something wrong happened, run a full build
if
should_build
:
#something wrong happened, run a full build
logger
.
info
(
'
B
uilding %s-%s-py%s (build: %d) for %s
'
,
logger
.
info
(
'
Re-b
uilding %s-%s-py%s (build: %d) for %s
'
,
rendered_recipe
[
'
package
'
][
'
name
'
],
rendered_recipe
[
'
package
'
][
'
name
'
],
rendered_recipe
[
'
package
'
][
'
version
'
],
python
.
replace
(
'
.
'
,
''
),
rendered_recipe
[
'
package
'
][
'
version
'
],
python
.
replace
(
'
.
'
,
''
),
build_number
,
arch
)
build_number
,
arch
)
...
@@ -184,12 +184,22 @@ def rebuild(recipe_dir, python, condarc, config, append_file,
...
@@ -184,12 +184,22 @@ def rebuild(recipe_dir, python, condarc, config, append_file,
# already resolved the "wrong" build number. We'll have to reparse after
# already resolved the "wrong" build number. We'll have to reparse after
# setting the environment variable BOB_BUILD_NUMBER.
# setting the environment variable BOB_BUILD_NUMBER.
set_environment
(
'
BOB_BUILD_NUMBER
'
,
str
(
build_number
))
set_environment
(
'
BOB_BUILD_NUMBER
'
,
str
(
build_number
))
metadata
=
get_rendered_metadata
(
d
,
conda_config
)
candidate
=
get_output_path
(
metadata
,
conda_config
)
if
os
.
path
.
exists
(
candidate
):
logger
.
debug
(
'
Removing existing conda package at %s for rebuild...
'
,
candidate
)
os
.
unlink
(
candidate
)
if
not
dry_run
:
if
not
dry_run
:
conda_build
.
api
.
build
(
d
,
config
=
conda_config
,
notest
=
no_test
)
conda_build
.
api
.
build
(
metadata
,
config
=
conda_config
,
notest
=
no_test
)
# if you get to this point, the package was successfully rebuilt
# set environment to signal caller we can upload it
os
.
environ
[
'
BDT_REBUILD
'
]
=
candidate
else
:
#skip build, test worked
else
:
#skip build, test worked
logger
.
info
(
'
Skipping build of %s-%s-py%s (build: %d) for %s
'
,
logger
.
info
(
'
Skipping
re
build of %s-%s-py%s (build: %d) for %s
'
,
rendered_recipe
[
'
package
'
][
'
name
'
],
rendered_recipe
[
'
package
'
][
'
name
'
],
rendered_recipe
[
'
package
'
][
'
version
'
],
python
.
replace
(
'
.
'
,
''
),
rendered_recipe
[
'
package
'
][
'
version
'
],
python
.
replace
(
'
.
'
,
''
),
build_number
,
arch
)
build_number
,
arch
)
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