Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Caosdb Versions
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
caosdb
Software
Caosdb Versions
Commits
621d3af8
Verified
Commit
621d3af8
authored
2 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
PIPELINE: add versions.json
parent
4089bfc1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#31586
passed
2 years ago
Stage: info
Stage: pages
Stage: deploy
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+29
-7
29 additions, 7 deletions
.gitlab-ci.yml
test.tsv
+0
-6
0 additions, 6 deletions
test.tsv
versions.json
+2
-0
2 additions, 0 deletions
versions.json
with
31 additions
and
13 deletions
.gitlab-ci.yml
+
29
−
7
View file @
621d3af8
...
...
@@ -2,6 +2,12 @@ default:
image
:
alpine:latest
tags
:
[
docker
]
variables
:
SERVER
:
WEBUI
:
MYSQL
:
PYLIB
:
stages
:
-
info
-
commit
...
...
@@ -23,24 +29,40 @@ add-commit:
before_script
:
-
apk add curl
script
:
-
test -z "$CIPRIVATETOKEN" && echo "CIPRIVATETOKEN was empty"
-
test -z "$CIPRIVATETOKEN" && echo "CIPRIVATETOKEN variable was empty" && exit 1;
-
test -z "$SERVER" && echo "SERVER variable was empty" && exit 1;
-
COLON=':'
-
echo "test" >> test.tsv
-
echo -n "{\"branch\"${COLON} \"main\", \"commit_message\"${COLON} \"new commit via ci pipeline\", \"actions\"${COLON} [ { \"action\"${COLON} \"update\", \"file_path\"${COLON} \"test.tsv\", \"encoding\"${COLON} \"base64\", \"content\"${COLON} \"" > commit.json
-
echo -n "$(base64 test.tsv)" >> commit.json
# delete last line (array closing bracket ']')
-
sed -i '$d' versions.json
# add new record
-
echo ",{\"server\"${COLON} \"$SERVER\", \"mysqlbackend\"${COLON} \"$MYSQL\", \"pylib\"${COLON} \"$PYLIB\", \"webui\"${COLON} \"$WEBUI\" }" >> versions.json
# add closing ] again
-
echo "\n]"
# create the commit.json which is to send to the commit api of gitlab
-
echo -n "{\"branch\"${COLON} \"main\", \"commit_message\"${COLON} \"new commit via ci pipeline\", \"actions\"${COLON} [ { \"action\"${COLON} \"update\", \"file_path\"${COLON} \"versions.json\", \"encoding\"${COLON} \"base64\", \"content\"${COLON} \"" > commit.json
-
echo -n "$(base64 versions.json)" >> commit.json
-
echo -n '" } ] }' >> commit.json
# for debugging
-
cat commit.json
# commit the changes (which then triggers the pages job)
-
curl --fail-with-body --request POST --header "PRIVATE-TOKEN${COLON} $CIPRIVATETOKEN" --header "Content-Type${COLON} application/json" --data "$(cat commit.json)" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/repository/commits"
pages
:
rules
:
-
changes
:
-
test.tsv
-
versions.json
stage
:
pages
script
:
-
mkdir -p public
-
cp
test.tsv
public/
-
echo '<a href="
test.tsv">test.tsv
</a>' > public/index.html
-
cp
versions.json
public/
-
echo '<a href="
versions.json">versions.json
</a>' > public/index.html
artifacts
:
paths
:
-
public
This diff is collapsed.
Click to expand it.
test.tsv
deleted
100644 → 0
+
0
−
6
View file @
4089bfc1
new contenttest
test
test
test
test
test
This diff is collapsed.
Click to expand it.
versions.json
0 → 100644
+
2
−
0
View file @
621d3af8
[{}
]
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