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
9d7629ab
Commit
9d7629ab
authored
6 months ago
by
Kwangjin Lee
Browse files
Options
Downloads
Patches
Plain Diff
Update .gitlab-ci.yml file
parent
65b40110
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+53
-90
53 additions, 90 deletions
.gitlab-ci.yml
with
53 additions
and
90 deletions
.gitlab-ci.yml
+
53
−
90
View file @
9d7629ab
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"
cache
:
paths
:
-
.pip-cache/
image
:
alpine:latest
stages
:
-
check_changes
-
process
-
deploy
.install_dependencies
:
before_script
:
-
apt-get update && apt-get install -y curl jq
-
pip install jupytext nbconvert
before_script
:
-
apk add --no-cache curl
check_change
s
:
stage
:
check_changes
deploy-draft-student
s
:
stage
:
deploy
script
:
-
|
changes=$(git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA)
if echo "$changes" | grep -qvE "^src/"; then
echo "FULL_PROCESS=true" >> pipeline.env
else
echo "FULL_PROCESS=false" >> pipeline.env
fi
echo "$changes" > changed_files.txt
artifacts
:
reports
:
dotenv
:
pipeline.env
paths
:
-
changed_files.txt
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
process_notebooks
:
stage
:
process
extends
:
.install_dependencies
deploy-teachers
:
stage
:
deploy
script
:
-
|
if [ "$FULL_PROCESS" = "true" ]; then
for notebook in $(find ./src -name "*.ipynb"); do
clean_notebook=$(echo $notebook | sed 's/src/clean/')
mkdir -p $(dirname $clean_notebook)
cp $notebook $clean_notebook
jupyter nbconvert --ClearOutputPreprocessor.enabled=True --to notebook --inplace $clean_notebook
jupytext --to md $clean_notebook
jupytext --to py:percent $clean_notebook
done
else
echo "Skipping full processing"
fi
artifacts
:
paths
:
-
src/
-
clean/
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
deploy
:
deploy
-production-students
:
stage
:
deploy
extends
:
.install_dependencies
script
:
-
|
changed_files=$(cat changed_files.txt | jq -R -s -c 'split("\n")')
full_process=$FULL_PROCESS
deploy_payload=$(jq -n \
--arg kind "pipeline" \
--arg status "success" \
--arg ref "$CI_COMMIT_REF_NAME" \
--argjson changes "$changed_files" \
--argjson full_process $full_process \
'{
object_kind: $kind,
object_attributes: {
status: $status,
ref: $ref
},
changes: $changes,
full_process: $full_process
}')
if [[ "$CI_COMMIT_BRANCH" == "main" && "$changed_files" == *"src/students/"* ]]; then
curl -X POST "${WEBHOOK_URL}/files-sync-students-draft" \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: ${WEBHOOK_TOKEN}" \
-d "$deploy_payload"
fi
if [[ "$CI_COMMIT_BRANCH" == "main" && "$changed_files" == *"src/teachers/"* ]]; then
curl -X POST "${WEBHOOK_URL}/files-sync-teachers" \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: ${WEBHOOK_TOKEN}" \
-d "$deploy_payload"
fi
if [[ "$CI_COMMIT_BRANCH" == "release" && "$changed_files" == *"src/students/"* ]]; then
curl -X POST "${WEBHOOK_URL}/files-sync-students" \
-H "Content-Type: application/json" \
-H "X-Gitlab-Token: ${WEBHOOK_TOKEN}" \
-d "$deploy_payload"
fi
\ No newline at end of file
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"
}
}'
rules
:
-
if
:
$CI_COMMIT_BRANCH == "release"
changes
:
-
src/students/**/*
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