Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eic_container
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
Show more breadcrumbs
containers
eic_container
Commits
defef6c1
Commit
defef6c1
authored
1 year ago
by
Wouter Deconinck
Browse files
Options
Downloads
Patches
Plain Diff
feat: install environment and push to buildcache with Makefile
parent
0d0eb73b
No related branches found
No related tags found
1 merge request
!540
feat: install environment and push to buildcache with Makefile
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+6
-0
6 additions, 0 deletions
.gitlab-ci.yml
containers/jug/dev.Dockerfile
+9
-65
9 additions, 65 deletions
containers/jug/dev.Dockerfile
spack-environment/Makefile
+39
-0
39 additions, 0 deletions
spack-environment/Makefile
with
54 additions
and
65 deletions
.gitlab-ci.yml
+
6
−
0
View file @
defef6c1
...
@@ -36,6 +36,9 @@ variables:
...
@@ -36,6 +36,9 @@ variables:
65bd9b9ac556480b4a9dcc60f7539492af195d4a
65bd9b9ac556480b4a9dcc60f7539492af195d4a
1a32cea11495cbdd699fea4fe622babab83e630d
1a32cea11495cbdd699fea4fe622babab83e630d
6edc4807369a05786e36f63b5d959588ae94a1fa
6edc4807369a05786e36f63b5d959588ae94a1fa
af74680405c931dab16c6674f9b97a32bf3f1122
0a952f8b7bf6f70009dd5821bccbaf9170c73d07
f050b1cf7835fd31992b020e1061c52294ff7330
## Ref: https://github.com/spack/spack/commit/[hash]
## Ref: https://github.com/spack/spack/commit/[hash]
## [hash]: [description]
## [hash]: [description]
## b5ef5c2eb5145020f9de1bcb964626ce6ac2d02e: geant4: version bumps for Geant4 11.1.0
## b5ef5c2eb5145020f9de1bcb964626ce6ac2d02e: geant4: version bumps for Geant4 11.1.0
...
@@ -62,6 +65,9 @@ variables:
...
@@ -62,6 +65,9 @@ variables:
## 65bd9b9ac556480b4a9dcc60f7539492af195d4a: podio, edm4hep: add v0.7.2 and v0.16.1 respectively
## 65bd9b9ac556480b4a9dcc60f7539492af195d4a: podio, edm4hep: add v0.7.2 and v0.16.1 respectively
## 1a32cea11495cbdd699fea4fe622babab83e630d: podio: add v0.16.2
## 1a32cea11495cbdd699fea4fe622babab83e630d: podio: add v0.16.2
## 6edc4807369a05786e36f63b5d959588ae94a1fa: podio: Add version 0.16.3
## 6edc4807369a05786e36f63b5d959588ae94a1fa: podio: Add version 0.16.3
## af74680405c931dab16c6674f9b97a32bf3f1122: depfile: improve tab completion
## 0a952f8b7bf6f70009dd5821bccbaf9170c73d07: docs updates for spack env depfile
## f050b1cf7835fd31992b020e1061c52294ff7330: depfile: variable with all identifiers
## EIC spack organization and repository, e.g. eic/eic-spack
## EIC spack organization and repository, e.g. eic/eic-spack
EICSPACK_ORGREPO
:
"
eic/eic-spack"
EICSPACK_ORGREPO
:
"
eic/eic-spack"
...
...
This diff is collapsed.
Click to expand it.
containers/jug/dev.Dockerfile
+
9
−
65
View file @
defef6c1
...
@@ -100,77 +100,21 @@ RUN git clone https://github.com/${EICSPACK_ORGREPO}.git ${EICSPACK_ROOT} \
...
@@ -100,77 +100,21 @@ RUN git clone https://github.com/${EICSPACK_ORGREPO}.git ${EICSPACK_ROOT} \
## Setup our custom environment
## Setup our custom environment
COPY
--from=spack spack-environment/ /opt/spack-environment/
COPY
--from=spack spack-environment/ /opt/spack-environment/
ARG
ENV=dev
ARG
ENV=dev
RUN
rm
-r
/usr/local
\
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack-mirror,sharing
=
locked
\
&&
cd
/opt/spack-environment
\
cd
/opt/spack-environment
\
&&
rm
-r
/usr/local
\
&&
source
$SPACK_ROOT
/share/spack/setup-env.sh
\
&&
source
$SPACK_ROOT
/share/spack/setup-env.sh
\
&&
spack
env
activate
--dir
/opt/spack-environment/
${
ENV
}
\
&&
spack
env
activate
--dir
/opt/spack-environment/
${
ENV
}
\
&&
spack concretize
--fresh
&&
make
-C
/opt/spack-environment
SPACK_ENV
=
${
ENV
}
\
BUILDCACHE_DIR
=
/var/cache/spack-mirror
\
BUILDCACHE_MIRROR
=
eic-spack
## Now execute the main build (or fetch from cache if possible)
## note, no-check-signature is needed to allow the quicker signature-less
## packages from the internal (docker) buildcache
##
## Optional, nuke the buildcache after install, before (re)caching
## Optional, nuke the buildcache after install, before (re)caching
## This is useful when going to completely different containers,
## This is useful when going to completely different containers,
## or intermittently to keep the buildcache step from taking too much time
## or intermittently to keep the buildcache step from taking too much time
##
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack-mirror,sharing
=
locked
\
## Update the local build cache if needed. Consists of 3 steps:
[
-z
"
${
CACHE_NUKE
}
"
]
\
## 1. Remove the eic-spack buildcache on S3
||
rm
-rf
/var/cache/spack-mirror/build_cache/
*
## 2. Get a list of all packages, and compare with what is already on
## the buildcache (using package hash)
## 3. Add packages that need to be added to buildcache if any
RUN
--mount
=
type
=
cache,target
=
/var/cache/spack-mirror
\
cd
/opt/spack-environment
\
&&
source
$SPACK_ROOT
/share/spack/setup-env.sh
\
&&
spack
env
activate
--dir
/opt/spack-environment/
${
ENV
}
\
&&
status
=
0
\
&&
spack
install
-j64
--no-check-signature
\
||
spack
install
-j64
--no-check-signature
\
||
spack
install
-j64
--no-check-signature
--show-log-on-error
\
||
status
=
$?
\
&&
spack mirror
rm
--scope
site eic-spack
\
&&
[
-z
"
${
CACHE_NUKE
}
"
]
\
||
rm
-rf
/var/cache/spack-mirror/build_cache/
*
\
&&
mkdir
-p
/var/cache/spack-mirror/build_cache
\
&&
spack buildcache update-index
-d
/var/cache/spack-mirror
\
&&
spack buildcache list
--allarch
--very-long
\
|
sed
'/^$/d;/^--/d;s/@.\+//;s/\([a-z0-9]*\) \(.*\)/\2\/\1/'
\
|
sort
>
buildcache.local.txt
\
&&
spack find
--format
{
name
}
/
{
hash
}
|
sort
\
|
comm
-23
- buildcache.local.txt
\
| xargs
--verbose
--no-run-if-empty
\
spack buildcache create
--allow-root
--only
package
--unsigned
\
--directory
/var/cache/spack-mirror
\
--rebuild-index
\
&&
spack clean
-a
\
&&
exit
$status
## Update the S3 build cache (without local cache mount)
ARG
S3RW_ACCESS_KEY=""
ARG
S3RW_SECRET_KEY=""
RUN
cd
/opt/spack-environment
\
&&
source
$SPACK_ROOT
/share/spack/setup-env.sh
\
&&
spack
env
activate
--dir
/opt/spack-environment/
${
ENV
}
\
&&
if
[
-n
"
${
S3RW_ACCESS_KEY
}
"
]
;
then
\
spack mirror add
--scope
site
\
--s3-endpoint-url
https://eics3.sdcc.bnl.gov:9000
\
--s3-access-key-id
"
${
S3RW_ACCESS_KEY
}
"
\
--s3-access-key-secret
"
${
S3RW_SECRET_KEY
}
"
\
eic-spack s3://eictest/EPIC/spack
\
&&
spack mirror list
\
&&
spack buildcache list
--allarch
--very-long
\
|
sed
'/^$/d;/^--/d;s/@.\+//;s/\([a-z0-9]*\) \(.*\)/\2\/\1/'
\
|
sort
>
buildcache.eic-spack.txt
\
&&
spack find
--format
{
name
}
/
{
hash
}
|
sort
\
|
comm
-23
- buildcache.eic-spack.txt
\
| xargs
--verbose
--no-run-if-empty
\
spack buildcache create
--allow-root
--only
package
--unsigned
\
--mirror-name
eic-spack
\
&&
spack buildcache update-index
--mirror-url
eic-spack
\
&&
spack mirror
rm
--scope
site eic-spack
\
;
fi
\
&&
spack mirror list
## Extra post-spack steps:
## Extra post-spack steps:
## - Python packages
## - Python packages
...
...
This diff is collapsed.
Click to expand it.
spack-environment/Makefile
0 → 100644
+
39
−
0
View file @
defef6c1
MAKEFLAGS
+=
-Orecurse
SPACK
?=
spack
SPACK_INSTALL_FLAGS
+=
--no-check-signature
export
SPACK_COLOR
=
always
SPACK_ENV
?=
dev
BUILDCACHE_DIR
:=
$(
SPACK_ENV
)
/cache
BUILDCACHE_MIRROR
:=
.PHONY
:
all clean
all
:
$(SPACK_ENV)/push
ifeq
(,$(filter clean,$(MAKECMDGOALS)))
include
$(SPACK_ENV)/spack.mk
endif
$(SPACK_ENV)/push
:
$(addprefix $(SPACK_ENV)/push/
,
$($(SPACK_ENV)/SPACK_PACKAGE_IDS))
@
mkdir
-p
$(
BUILDCACHE_DIR
)
$(
foreach buildcache,
$(
BUILDCACHE_DIR
)
,
$(
SPACK
)
buildcache update-index
--mirror-url
$(
buildcache
)
;)
$(
foreach buildcache,
$(
BUILDCACHE_MIRROR
)
,
$(
SPACK
)
buildcache update-index
--mirror-url
$(
buildcache
)
;)
$(SPACK_ENV)/push/%
:
$(SPACK_ENV)/install/%
@
mkdir
-p
$(
dir
$@
)
$(
foreach buildcache,
$(
BUILDCACHE_DIR
)
,
$(
SPACK
)
buildcache create
--allow-root
--only
=
package
--unsigned
--directory
$(
buildcache
)
/
$(
HASH
)
;)
# push
$(
SPEC
)
$(
foreach buildcache,
$(
BUILDCACHE_MIRROR
)
,
$(
SPACK
)
buildcache create
--allow-root
--only
=
package
--unsigned
--mirror-name
$(
buildcache
)
/
$(
HASH
)
;)
# push
$(
SPEC
)
@
touch
$@
$(SPACK_ENV)/spack.lock
:
$(SPACK_ENV)/spack.yaml Makefile
$(
SPACK
)
concretize
--force
--fresh
$(SPACK_ENV)/spack.mk
:
$(SPACK_ENV)/spack.lock Makefile
$(
SPACK
)
env
depfile
--output
$@
--make-target-prefix
$(
SPACK_ENV
)
clean
:
rm
-rf
$(
SPACK_ENV
)
/spack.lock
$(
SPACK_ENV
)
/spack.mk
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