diff --git a/example-get-started/README.md b/example-get-started/README.md index 96cb520..c426e1f 100644 --- a/example-get-started/README.md +++ b/example-get-started/README.md @@ -49,6 +49,8 @@ git remote add origin git@github.com:/example-get-started.git # close open PRs gh pr close try-large-dataset gh pr close tune-hyperparams +# remove existing tags, branches, experiments +git ls-remote origin | awk '{print $2}' | xargs -n 1 git push --delete origin || true # force push branches git push --force origin main git push --force origin try-large-dataset diff --git a/example-get-started/code/.gitlab-ci.yml b/example-get-started/code/.gitlab-ci.yml index 05bcb0d..3669efa 100644 --- a/example-get-started/code/.gitlab-ci.yml +++ b/example-get-started/code/.gitlab-ci.yml @@ -1,14 +1,21 @@ -report: +report: + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + - if: $CI_COMMIT_BRANCH == 'main' image: dvcorg/cml:0-dvc3-base1 before_script: - - cml ci + - cml ci && cml --version - npm install -g json5 script: | - if [ $CI_COMMIT_BRANCH = main ]; then + if [ $CI_COMMIT_REF_NAME = main ]; then PREVIOUS_REF=HEAD~1 + COMMIT_HASH1=$CI_COMMIT_BEFORE_SHA + COMMIT_HASH2=$CI_COMMIT_SHA else PREVIOUS_REF=main git fetch --depth=1 origin main:main + COMMIT_HASH1=$CI_MERGE_REQUEST_DIFF_BASE_SHA + COMMIT_HASH2=$CI_COMMIT_SHA fi dvc pull eval @@ -33,6 +40,7 @@ report: cat < report.md # CML Report + [![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) ## Plots ![ROC](./roc.svg) ![Precision-Recall](./prc.svg) @@ -47,4 +55,8 @@ report: ${dvc_report} EOF - cml comment create --publish --pr=false report.md + if [ $CI_COMMIT_REF_NAME = main ]; then + cml comment create --target=commit report.md + else + cml comment update --target=pr report.md + fi