Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dedal
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EBRAINS RI
Tech Hub
Platform
EBRAINS Software Distribution
dedal
Commits
8ea93adc
Commit
8ea93adc
authored
8 months ago
by
Eric Müller
Browse files
Options
Downloads
Patches
Plain Diff
feat: add stage "build-base-image"
Change-Id: I056a1ec8f1055a672f9032b3eb0e6bbf6ad52e3f
parent
a62b2ce1
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
bin/yashchiki
+17
-6
17 additions, 6 deletions
bin/yashchiki
lib/yashchiki/build_base_sandbox.sh
+26
-0
26 additions, 0 deletions
lib/yashchiki/build_base_sandbox.sh
with
43 additions
and
6 deletions
bin/yashchiki
+
17
−
6
View file @
8ea93adc
#!/usr/bin/env python
#!/usr/bin/env python
3
import
argparse
import
os
...
...
@@ -51,7 +51,7 @@ parser = argparse.ArgumentParser(
to OUTPUT.
"""
))
all_stages
=
[
"
fetch
"
,
"
build-base
"
,
"
build-spack
"
,
"
image
"
]
all_stages
=
set
(
[
"
fetch
"
,
"
build-base-image
"
,
"
build-base
"
,
"
build-spack
"
,
"
image
"
]
)
all_styles
=
list
(
os
.
listdir
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
+
"
/../share/yashchiki/styles/
"
))
...
...
@@ -166,6 +166,7 @@ tmpdir.mkdir(exist_ok=True, parents=True)
env
=
os
.
environ
.
copy
()
env
.
update
({
"
DOCKER_BASE_IMAGE
"
:
config
[
"
docker_base_image
"
],
"
BUILD_BASE_SANDBOX
"
:
str
(
int
(
config
[
"
build_base_sandbox
"
])),
# This needs to be here because otherwise the default python
# (2.7.18) will pollute the spec and lead to a conflict
# can be removed as soon as the explicit preferred version
...
...
@@ -182,11 +183,13 @@ env.update({
"
YASHCHIKI_SPACK_VERBOSE
"
:
str
(
int
(
args
.
spack_verbose
)),
"
YASHCHIKI_SANDBOXES
"
:
args
.
sandboxes_dir
,
"
YASHCHIKI_IMAGE_NAME
"
:
args
.
output
,
"
YASHCHIKI_BASEIMAGE_NAME
"
:
str
(
args
.
output
)
+
"
_base
"
,
# FIXME: nicer, it's a path on the left!
"
YASHCHIKI_SPACK_PATH
"
:
args
.
spack_dir
,
"
YASHCHIKI_BUILD_CACHE_NAME
"
:
args
.
build_cache_name
,
"
TMPDIR
"
:
tmpdir
,
"
YASHCHIKI_CACHES_ROOT
"
:
args
.
caches_dir
,
"
YASHCHIKI_JOBS
"
:
str
(
args
.
jobs
),
"
ROOT_DIR
"
:
root_dir
,
})
needs_spackdir
=
False
...
...
@@ -195,10 +198,15 @@ if "fetch" in args.stages:
env
.
update
({
"
YASHCHIKI_ENABLE_STAGE_FETCH
"
:
"
1
"
})
needs_spackdir
=
True
if
"
build-base-image
"
in
args
.
stages
:
env
.
update
({
"
YASHCHIKI_ENABLE_STAGE_BUILD_BASE_IMAGE
"
:
"
1
"
})
# FIXME: better called build-sandbox, etc.?
if
"
build-base
"
in
args
.
stages
:
env
.
update
({
"
YASHCHIKI_ENABLE_STAGE_BUILD_BASE
"
:
"
1
"
})
needs_spackdir
=
True
# FIXME: unused?
if
"
build-spack
"
in
args
.
stages
:
env
.
update
({
"
YASHCHIKI_ENABLE_STAGE_BUILD_SPACK
"
:
"
1
"
})
needs_spackdir
=
True
...
...
@@ -206,9 +214,10 @@ if "build-spack" in args.stages:
if
"
image
"
in
args
.
stages
:
env
.
update
({
"
YASHCHIKI_ENABLE_STAGE_IMAGE
"
:
"
1
"
})
if
args
.
stages
!=
all_stages
:
if
not
pathlib
.
Path
(
args
.
sandboxes_dir
,
args
.
style
).
exists
():
raise
RuntimeError
(
"
Using yashchiki with incomplete set of stages is only possible for using an existing sandbox.
"
)
# FIXME: readd this reasonably
#if (args.stages != set('fetch', ']) and (args.stages != all_stages):
# if not pathlib.Path(args.sandboxes_dir, args.style).exists():
# raise RuntimeError("Using yashchiki with incomplete set of stages is only possible for using an existing sandbox.")
if
needs_spackdir
:
if
not
args
.
spack_dir
.
is_dir
():
...
...
@@ -222,6 +231,7 @@ if args.build_cache_on_failure_name:
args
.
log_dir
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
import
time
def
run
(
script
:
str
,
env
:
dict
,
script_args
:
list
=
[]):
"""
Execute the given script.
...
...
@@ -322,6 +332,8 @@ env.update({"YASHCHIKI_META_DIR": meta_dir})
run
(
"
lib/yashchiki/create_caches.sh
"
,
env
)
run
(
"
lib/yashchiki/fetch.sh
"
,
env
)
if
config
.
get
(
"
docker_base_image
"
,
False
):
run
(
"
lib/yashchiki/build_base_sandbox.sh
"
,
env
,
[
base_sandbox_recipe
])
run
(
str
(
pathlib
.
Path
(
"
share
"
,
"
yashchiki
"
,
"
styles
"
,
args
.
style
,
"
create_recipe.sh
"
)),
env
)
...
...
@@ -332,4 +344,3 @@ if args.update_build_cache:
if
args
.
tmpdir
is
None
:
shutil
.
rmtree
(
tmpdir
)
This diff is collapsed.
Click to expand it.
lib/yashchiki/build_base_sandbox.sh
0 → 100755
+
26
−
0
View file @
8ea93adc
#!/bin/bash
set
-euo
pipefail
shopt
-s
inherit_errexit 2>/dev/null
||
true
if
[
-z
"
${
YASHCHIKI_ENABLE_STAGE_BUILD_BASE_IMAGE
:-}
"
]
;
then
echo
"Skipping stage build-base-image."
exit
0
fi
# set generic locale for building
export
LANG
=
C.UTF-8
export
LC_ALL
=
C.UTF-8
unset
LC_CTYPE
unset
LC_COLLATE
unset
LC_MONETARY
unset
LC_NUMERIC
unset
LC_TIME
unset
LC_MESSAGES
TARGET_FOLDER
=
"
${
YASHCHIKI_SANDBOXES
}
/
${
CONTAINER_STYLE
}
"
mkdir
-p
${
YASHCHIKI_SANDBOXES
}
apptainer build
--fakeroot
--force
${
YASHCHIKI_BASEIMAGE_NAME
}
$1
This diff is collapsed.
Click to expand it.
Preview
0%
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