Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
2024-files
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MUDE
2024-files
Commits
a3b0414a
Commit
a3b0414a
authored
4 months ago
by
Kwangjin Lee
Browse files
Options
Downloads
Patches
Plain Diff
Update .gitlab-ci.yml file
parent
5aad94b9
No related branches found
No related tags found
No related merge requests found
Pipeline
#260075
failed
4 months ago
Stage: setup
Stage: sync
Stage: update_repo
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+67
-50
67 additions, 50 deletions
.gitlab-ci.yml
with
67 additions
and
50 deletions
.gitlab-ci.yml
+
67
−
50
View file @
a3b0414a
image
:
alpine:latest
image
:
python:3.9
variables
:
PIP_CACHE_DIR
:
"
$CI_PROJECT_DIR/.pip-cache"
WEBHOOK_URL
:
"
https://mude.citg.tudelft.nl/hooks"
WEBHOOK_TOKEN
:
"
glpat-Lohnt8MN6nWzpcwyhprL"
GIT_STRATEGY
:
clone
cache
:
paths
:
-
.pip-cache/
stages
:
-
setup
-
sync
-
update_repo
-
deploy
before_script
:
-
apk add --no-cache curl
setup
:
stage
:
setup
script
:
-
apt-get update && apt-get install -y curl git
-
pip install jupytext nbconvert
artifacts
:
paths
:
-
.pip-cache/
deploy-draft-student
s
:
stage
:
deploy
sync_notebook
s
:
stage
:
sync
script
:
-
mkdir -p synced_files
-
|
curl -X POST https://mude.citg.tudelft.nl/hooks/files-sync-students-draft \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: glpat-Lohnt8MN6nWzpcwyhprL" \
-d '{
"object_kind": "pipeline",
"object_attributes": {
"status": "success",
"ref": "main"
}
}'
rules
:
-
if
:
$CI_COMMIT_BRANCH == "main"
changes
:
-
src/students/**/*
when
:
always
for notebook in $(find ./src -name "*.ipynb"); do
relative_path=${notebook#./src/}
synced_dir="synced_files/$(dirname $relative_path)"
mkdir -p "$synced_dir"
# Convert to various formats
jupytext --to notebook "$notebook" -o "${synced_dir}/$(basename ${notebook%.ipynb}).ipynb"
jupytext --to markdown "$notebook" -o "${synced_dir}/$(basename ${notebook%.ipynb}).md"
jupytext --to py:percent "$notebook" -o "${synced_dir}/$(basename ${notebook%.ipynb}).py"
# Strip outputs from the notebook
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to notebook --inplace "${synced_dir}/$(basename $notebook)"
done
artifacts
:
paths
:
-
synced_files/
deploy-teachers
:
stage
:
deploy
update_repo
:
stage
:
update_repo
script
:
-
git config user.name "GitLab CI"
-
git config user.email "gitlab-ci@example.com"
-
git add synced_files/
-
|
curl -X POST https://mude.citg.tudelft.nl/hooks/files-sync-teachers \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: glpat-Lohnt8MN6nWzpcwyhprL" \
-d '{
"object_kind": "pipeline",
"object_attributes": {
"status": "success",
"ref": "main"
}
}'
rules
:
-
if
:
$CI_COMMIT_BRANCH == "main"
changes
:
-
src/teachers/**/*
when
:
always
if [ -n "$(git status --porcelain)" ]; then
git commit -m "Update synced files [skip ci]"
git push "https://oauth2:${GIT_PUSH_TOKEN}@gitlab.com/${CI_PROJECT_PATH}.git" HEAD:$CI_COMMIT_REF_NAME
else
echo "No changes to commit"
fi
deploy
-production-students
:
deploy
:
stage
:
deploy
script
:
-
|
curl -X POST https://mude.citg.tudelft.nl/hooks/files-sync-students \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: glpat-Lohnt8MN6nWzpcwyhprL" \
-d '{
"object_kind": "pipeline",
"object_attributes": {
"status": "success",
"ref": "release"
}
}'
for webhook in "files-sync-students-draft" "files-sync-teachers" "files-sync-students"; do
curl -X POST "${WEBHOOK_URL}/${webhook}" \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: ${WEBHOOK_TOKEN}" \
-d '{
"object_kind": "pipeline",
"object_attributes": {
"status": "success",
"ref": "'"$CI_COMMIT_REF_NAME"'"
}
}'
done
rules
:
-
if
:
$CI_COMMIT_BRANCH == "release"
-
if
:
$CI_COMMIT_BRANCH ==
"main" || $CI_COMMIT_BRANCH ==
"release"
changes
:
-
src/
students/
**/*
-
src/**/*
when
:
always
\ No newline at end of file
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