Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ebrains-spack-builds
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Han Lu
ebrains-spack-builds
Commits
79ff7e58
Commit
79ff7e58
authored
11 months ago
by
Eleni Mathioulaki
Browse files
Options
Downloads
Patches
Plain Diff
feat: move deployment script from image into k8s job
parent
8431e2e0
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-ci.yml
+1
-1
1 addition, 1 deletion
.gitlab-ci.yml
create_job.sh
+52
-19
52 additions, 19 deletions
create_job.sh
with
53 additions
and
20 deletions
.gitlab-ci.yml
+
1
−
1
View file @
79ff7e58
...
@@ -18,7 +18,7 @@ variables:
...
@@ -18,7 +18,7 @@ variables:
-
oc project $OC_PROJECT
-
oc project $OC_PROJECT
# create job description file
# create job description file
-
chmod a+x create_job.sh
-
chmod a+x create_job.sh
-
./create_job.sh $CI_PIPELINE_ID $BUILD_ENV_DOCKER_IMAGE
update
$INSTALLATION_ROOT $SPACK_VERSION $SPACK_ENV $CI_COMMIT_BRANCH $RELEASE_NAME $LAB_KERNEL_ROOT
-
./create_job.sh $CI_PIPELINE_ID $BUILD_ENV_DOCKER_IMAGE $INSTALLATION_ROOT $SPACK_VERSION $SPACK_ENV $CI_COMMIT_BRANCH $RELEASE_NAME $LAB_KERNEL_ROOT
-
cat simplejob.yml
-
cat simplejob.yml
# start the deploy job
# start the deploy job
-
oc create -f simplejob.yml
-
oc create -f simplejob.yml
...
...
This diff is collapsed.
Click to expand it.
create_job.sh
+
52
−
19
View file @
79ff7e58
...
@@ -2,20 +2,19 @@
...
@@ -2,20 +2,19 @@
# ===========================================================================================================
# ===========================================================================================================
# title : create_job.sh
# title : create_job.sh
# usage : ./create_job.sh $OC_JOB_ID $BUILD_ENV_DOCKER_IMAGE
$OP
$INSTALLATION_ROOT $SPACK_VERSION
# usage : ./create_job.sh $OC_JOB_ID $BUILD_ENV_DOCKER_IMAGE $INSTALLATION_ROOT $SPACK_VERSION
# $SPACK_ENV $BRANCH $RELEASE_NAME $LAB_KERNEL_ROOT
# $SPACK_ENV $BRANCH $RELEASE_NAME $LAB_KERNEL_ROOT
# description : creates OKD job yaml file that builds/updates spack environment and creates Lab kernel
# description : creates OKD job yaml file that builds/updates spack environment and creates Lab kernel
# ===========================================================================================================
# ===========================================================================================================
OC_JOB_ID
=
$1
OC_JOB_ID
=
$1
BUILD_ENV_DOCKER_IMAGE
=
$2
BUILD_ENV_DOCKER_IMAGE
=
$2
OP
=
$3
INSTALLATION_ROOT
=
$3
INSTALLATION_ROOT
=
$4
SPACK_VERSION
=
$4
SPACK_VERSION
=
$5
EBRAINS_SPACK_ENV
=
$5
SPACK_ENV
=
$6
BRANCH
=
$6
BRANCH
=
$7
RELEASE_NAME
=
$7
RELEASE_NAME
=
$8
LAB_KERNEL_ROOT
=
$8
LAB_KERNEL_ROOT
=
$9
cat
<<
EOT
>> simplejob.yml
cat
<<
EOT
>> simplejob.yml
apiVersion: batch/v1
apiVersion: batch/v1
...
@@ -37,20 +36,54 @@ spec:
...
@@ -37,20 +36,54 @@ spec:
volumeMounts:
volumeMounts:
- name: sharedbin
- name: sharedbin
mountPath: /srv
mountPath: /srv
command: ["/usr/local/bin/deploy-build-env.sh", "
$OP
", "
$INSTALLATION_ROOT
", "
$SPACK_VERSION
", "
$SPACK_ENV
", "
$BRANCH
", "
$RELEASE_NAME
", "
$LAB_KERNEL_ROOT
"]
command:
- /bin/bash
- -c
- |
# create root dir if it doesn't exist
mkdir -p
\$
INSTALLATION_ROOT
# reset build error log dir (delete previous logs to save space)
rm -rf
\$
BUILD_LOGS_DIR
mkdir -p
\$
BUILD_LOGS_DIR
# reset spack repository dir by cloning the selected version
rm -rf
\$
EBRAINS_REPO_PATH
git clone https://gitlab.ebrains.eu/technical-coordination/project-internal/devops/platform/ebrains-spack-builds.git --branch
\$
BRANCH
\$
EBRAINS_REPO_PATH
# run installation script
.
\$
EBRAINS_REPO_PATH/install_spack_env.sh
\$
INSTALLATION_ROOT
\$
SPACK_VERSION
\$
EBRAINS_REPO_PATH
\$
EBRAINS_SPACK_ENV
if [
\$
? -eq 0 ]
then
# build process succeeded - create or update kernel on the NFS based on the current spack environment
chmod +x
\$
EBRAINS_REPO_PATH/create_JupyterLab_kernel.sh
\$
EBRAINS_REPO_PATH/create_JupyterLab_kernel.sh
\$
INSTALLATION_ROOT
\$
EBRAINS_SPACK_ENV
\$
RELEASE_NAME
\$
LAB_KERNEL_ROOT
exit 0
else
# build process failed - keep spack build logs and fail the pipeline
cp -r /tmp/spack/spack-stage/*
\$
SPACK_BUILD_LOGS
exit
fi
env:
env:
- name: SYSTEMNAME
- name: SYSTEMNAME
value: ebrainslab
value: ebrainslab
- name: GITLAB_USER
- name: INSTALLATION_ROOT
valueFrom:
value:
$INSTALLATION_ROOT
secretKeyRef:
- name: SPACK_VERSION
name: spack-repo-gitlab-token
value:
$SPACK_VERSION
key: username
- name: EBRAINS_SPACK_ENV
- name: GITLAB_TOKEN
value:
$EBRAINS_SPACK_ENV
valueFrom:
- name: BRANCH
secretKeyRef:
value:
$BRANCH
name: spack-repo-gitlab-token
- name: RELEASE_NAME
key: password
value:
$RELEASE_NAME
- name: LAB_KERNEL_ROOT
value:
$LAB_KERNEL_ROOT
- name: BUILD_LOGS_DIR
value: /srv/build_logs/
$EBRAINS_SPACK_ENV
- name: EBRAINS_REPO_PATH
value:
$INSTALLATION_ROOT
/ebrains-spack-builds
volumes:
volumes:
- name: sharedbin
- name: sharedbin
persistentVolumeClaim:
persistentVolumeClaim:
...
...
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