Skip to content

Commit 69d9e19

Browse files
authored
feat(example-get-started): update ci, studio link, proper rules (#284)
1 parent 1ab0473 commit 69d9e19

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

example-get-started/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ git remote add origin [email protected]:<slug>/example-get-started.git
4949
# close open PRs
5050
gh pr close try-large-dataset
5151
gh pr close tune-hyperparams
52+
# remove existing tags, branches, experiments
53+
git ls-remote origin | awk '{print $2}' | xargs -n 1 git push --delete origin || true
5254
# force push branches
5355
git push --force origin main
5456
git push --force origin try-large-dataset

example-get-started/code/.gitlab-ci.yml

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
report:
1+
report:
2+
rules:
3+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
4+
- if: $CI_COMMIT_BRANCH == 'main'
25
image: dvcorg/cml:0-dvc3-base1
36
before_script:
4-
- cml ci
7+
- cml ci && cml --version
58
- npm install -g json5
69
script: |
7-
if [ $CI_COMMIT_BRANCH = main ]; then
10+
if [ $CI_COMMIT_REF_NAME = main ]; then
811
PREVIOUS_REF=HEAD~1
12+
COMMIT_HASH1=$CI_COMMIT_BEFORE_SHA
13+
COMMIT_HASH2=$CI_COMMIT_SHA
914
else
1015
PREVIOUS_REF=main
1116
git fetch --depth=1 origin main:main
17+
COMMIT_HASH1=$CI_MERGE_REQUEST_DIFF_BASE_SHA
18+
COMMIT_HASH2=$CI_COMMIT_SHA
1219
fi
1320
1421
dvc pull eval
@@ -33,6 +40,7 @@ report:
3340
3441
cat <<EOF > report.md
3542
# CML Report
43+
[![DVC](https://img.shields.io/badge/-Open_in_Studio-grey?style=flat-square&logo=dvc)](https://studio.iterative.ai/team/Iterative/views/example-get-started-2gpv7kdqx2?panels=plots%2C%3Bcompare%2C&commits=${COMMIT_HASH2}%3B${COMMIT_HASH1}&activeCommits=${COMMIT_HASH1}%3Aprimary%3B${COMMIT_HASH2}%3Apurple)
3644
## Plots
3745
![ROC](./roc.svg)
3846
![Precision-Recall](./prc.svg)
@@ -47,4 +55,8 @@ report:
4755
${dvc_report}
4856
EOF
4957
50-
cml comment create --publish --pr=false report.md
58+
if [ $CI_COMMIT_REF_NAME = main ]; then
59+
cml comment create --target=commit report.md
60+
else
61+
cml comment update --target=pr report.md
62+
fi

0 commit comments

Comments
 (0)