From 883de6b5419ab98daf094fd744394bcc59e59cae Mon Sep 17 00:00:00 2001 From: Kai Szuttor Date: Thu, 4 Apr 2019 08:01:59 +0200 Subject: [PATCH 1/7] CI: output number of created issue. --- maintainer/gh_create_issue.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/maintainer/gh_create_issue.sh b/maintainer/gh_create_issue.sh index 3c3082ba66e..0c32be9c16e 100755 --- a/maintainer/gh_create_issue.sh +++ b/maintainer/gh_create_issue.sh @@ -2,9 +2,10 @@ URL=$(echo "https://gitlab.icp.uni-stuttgart.de/espressomd/espresso/pipelines/${CI_PIPELINE_ID}") -curl -i -s "https://api.github.com/repos/espressomd/espresso/issues" \ +ISSUE_NUMBER=$(curl -s "https://api.github.com/repos/espressomd/espresso/issues" \ -H "Accept: application/vnd.github.full+json" \ -H "Content-Type: application/json" \ -H "Authorization: token $GITHUB_TOKEN" \ -X POST \ - -d "{\"title\": \"CI build failed for merged PR\", \"body\": \"$URL\" }" + -d "{\"title\": \"CI build failed for merged PR\", \"body\": \"$URL\" }" | jq .number) +echo $ISSUE_NUMBER From 10edde10b8cbaeaa4532e5d185261021565fcb05 Mon Sep 17 00:00:00 2001 From: Kai Szuttor Date: Thu, 4 Apr 2019 08:18:09 +0200 Subject: [PATCH 2/7] CI: added automatic closing of created issue. --- .gitlab-ci.yml | 18 +++++++++++++++++- maintainer/gh_close_issue.sh | 9 +++++++++ maintainer/gh_create_issue.sh | 5 ++--- 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100755 maintainer/gh_close_issue.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9eb6e002f2b..36a1dd3402f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,7 @@ stages: - additional_checks - deploy - result + - cleanup variables: GIT_SUBMODULE_STRATEGY: recursive @@ -385,7 +386,18 @@ status_failure: - linux dependencies: [] -notify: +notify_success: + stage: cleanup + script: bash maintainer/gh_close_issue.sh + when: on_success + only: + - python + tags: + - linux + dependencies: + - notify_failure + +notify_failure: stage: result script: bash maintainer/gh_create_issue.sh when: on_failure @@ -393,4 +405,8 @@ notify: - python tags: - linux + artifacts: + paths: + - ${CI_PROJECT_DIR}/ISSUE_NUMBER.txt + expire_in: 1 week dependencies: [] diff --git a/maintainer/gh_close_issue.sh b/maintainer/gh_close_issue.sh new file mode 100755 index 00000000000..3f28d672f2a --- /dev/null +++ b/maintainer/gh_close_issue.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +ISSUE_NUMBER=$(cat ${CI_PROJECT_DIR}/ISSUE_NUMBER.txt) +curl -s "https://api.github.com/repos/espressomd/espresso/issues/$ISSUE_NUMBER" \ + -H "Accept: application/vnd.github.full+json" \ + -H "Content-Type: application/json" \ + -H "Authorization: token $GITHUB_TOKEN" \ + -X PATCH \ + -d "{\"state\": \"closed\" }" diff --git a/maintainer/gh_create_issue.sh b/maintainer/gh_create_issue.sh index 0c32be9c16e..1a47f90bf49 100755 --- a/maintainer/gh_create_issue.sh +++ b/maintainer/gh_create_issue.sh @@ -2,10 +2,9 @@ URL=$(echo "https://gitlab.icp.uni-stuttgart.de/espressomd/espresso/pipelines/${CI_PIPELINE_ID}") -ISSUE_NUMBER=$(curl -s "https://api.github.com/repos/espressomd/espresso/issues" \ +curl -s "https://api.github.com/repos/espressomd/espresso/issues" \ -H "Accept: application/vnd.github.full+json" \ -H "Content-Type: application/json" \ -H "Authorization: token $GITHUB_TOKEN" \ -X POST \ - -d "{\"title\": \"CI build failed for merged PR\", \"body\": \"$URL\" }" | jq .number) -echo $ISSUE_NUMBER + -d "{\"title\": \"CI build failed for merged PR\", \"body\": \"$URL\" }" | jq .number > ${CI_PROJECT_DIR}/ISSUE_NUMBER.txt From 574b1fded72cf1a1b35984d769c5181319f8d114 Mon Sep 17 00:00:00 2001 From: Kai Szuttor Date: Thu, 4 Apr 2019 08:19:46 +0200 Subject: [PATCH 3/7] CI: testing. --- .gitlab-ci.yml | 4 ---- src/core/CMakeLists.txt | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 36a1dd3402f..e7b9684c2e0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -390,8 +390,6 @@ notify_success: stage: cleanup script: bash maintainer/gh_close_issue.sh when: on_success - only: - - python tags: - linux dependencies: @@ -401,8 +399,6 @@ notify_failure: stage: result script: bash maintainer/gh_create_issue.sh when: on_failure - only: - - python tags: - linux artifacts: diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 945ba3f69e4..9763f05ecfa 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,4 +1,5 @@ set(EspressoCore_SRC + abs.cpp accumulators.cpp cells.cpp collision.cpp From 5ce0a07a7472555beda561f20cb3d0600d21e6c5 Mon Sep 17 00:00:00 2001 From: Kai Szuttor Date: Thu, 4 Apr 2019 13:54:27 +0200 Subject: [PATCH 4/7] CI: added automatic closing of created issue. --- .gitlab-ci.yml | 9 +-------- maintainer/gh_close_issue.sh | 5 ++++- maintainer/gh_create_issue.sh | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e7b9684c2e0..1f5f2043f87 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -387,13 +387,11 @@ status_failure: dependencies: [] notify_success: - stage: cleanup + stage: result script: bash maintainer/gh_close_issue.sh when: on_success tags: - linux - dependencies: - - notify_failure notify_failure: stage: result @@ -401,8 +399,3 @@ notify_failure: when: on_failure tags: - linux - artifacts: - paths: - - ${CI_PROJECT_DIR}/ISSUE_NUMBER.txt - expire_in: 1 week - dependencies: [] diff --git a/maintainer/gh_close_issue.sh b/maintainer/gh_close_issue.sh index 3f28d672f2a..8169593133e 100755 --- a/maintainer/gh_close_issue.sh +++ b/maintainer/gh_close_issue.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash -ISSUE_NUMBER=$(cat ${CI_PROJECT_DIR}/ISSUE_NUMBER.txt) +ISSUE_NUMBER=$(curl -s -G https://api.github.com/search/issues \ + --data-urlencode "q=\"CI failed for merged PR\" org:espressomd repo:espresso is:open is:issue in:title" \ + --data-urlencode "q=${CI_PIPELINE_ID} org:espressomd repo:espresso is:open is:issue in:body" | jq '.items[0] .number') + curl -s "https://api.github.com/repos/espressomd/espresso/issues/$ISSUE_NUMBER" \ -H "Accept: application/vnd.github.full+json" \ -H "Content-Type: application/json" \ diff --git a/maintainer/gh_create_issue.sh b/maintainer/gh_create_issue.sh index 1a47f90bf49..23cba531edb 100755 --- a/maintainer/gh_create_issue.sh +++ b/maintainer/gh_create_issue.sh @@ -7,4 +7,4 @@ curl -s "https://api.github.com/repos/espressomd/espresso/issues" \ -H "Content-Type: application/json" \ -H "Authorization: token $GITHUB_TOKEN" \ -X POST \ - -d "{\"title\": \"CI build failed for merged PR\", \"body\": \"$URL\" }" | jq .number > ${CI_PROJECT_DIR}/ISSUE_NUMBER.txt + -d "{\"title\": \"CI build failed for merged PR\", \"body\": \"$URL\" }" From 3ca45e79c88f0c6097a25c95036c9bab793694d6 Mon Sep 17 00:00:00 2001 From: Kai Szuttor Date: Thu, 4 Apr 2019 14:45:29 +0200 Subject: [PATCH 5/7] CI: guard for github api post. --- maintainer/gh_close_issue.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/maintainer/gh_close_issue.sh b/maintainer/gh_close_issue.sh index 8169593133e..9b5bbac254e 100755 --- a/maintainer/gh_close_issue.sh +++ b/maintainer/gh_close_issue.sh @@ -4,9 +4,11 @@ ISSUE_NUMBER=$(curl -s -G https://api.github.com/search/issues \ --data-urlencode "q=\"CI failed for merged PR\" org:espressomd repo:espresso is:open is:issue in:title" \ --data-urlencode "q=${CI_PIPELINE_ID} org:espressomd repo:espresso is:open is:issue in:body" | jq '.items[0] .number') +if [ "$ISSUE_NUMBER" != "null" ]; then curl -s "https://api.github.com/repos/espressomd/espresso/issues/$ISSUE_NUMBER" \ -H "Accept: application/vnd.github.full+json" \ -H "Content-Type: application/json" \ -H "Authorization: token $GITHUB_TOKEN" \ -X PATCH \ -d "{\"state\": \"closed\" }" +fi From 3caf228ea5aa0f99024ca6917210d71753526cbd Mon Sep 17 00:00:00 2001 From: Kai Szuttor <2150555+KaiSzuttor@users.noreply.github.com> Date: Thu, 4 Apr 2019 14:49:35 +0200 Subject: [PATCH 6/7] Update .gitlab-ci.yml --- .gitlab-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1f5f2043f87..d4d6f12fecc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,7 +7,6 @@ stages: - additional_checks - deploy - result - - cleanup variables: GIT_SUBMODULE_STRATEGY: recursive From f02fd373875afe3a10140116ceb3621ae48a1ef8 Mon Sep 17 00:00:00 2001 From: Kai Szuttor Date: Thu, 4 Apr 2019 14:51:25 +0200 Subject: [PATCH 7/7] CI: only python, and unbreak CI. --- .gitlab-ci.yml | 4 ++++ src/core/CMakeLists.txt | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d4d6f12fecc..719d6d53c9d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -389,6 +389,8 @@ notify_success: stage: result script: bash maintainer/gh_close_issue.sh when: on_success + only: + - python tags: - linux @@ -396,5 +398,7 @@ notify_failure: stage: result script: bash maintainer/gh_create_issue.sh when: on_failure + only: + - python tags: - linux diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 9763f05ecfa..945ba3f69e4 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -1,5 +1,4 @@ set(EspressoCore_SRC - abs.cpp accumulators.cpp cells.cpp collision.cpp