Просмотр исходного кода

fix wercker.yml (trigger-crowi-plus-docker)

Yuki Takei 9 лет назад
Родитель
Сommit
e4903b3a5f
2 измененных файлов с 39 добавлено и 15 удалено
  1. 38 0
      bin/wercker/trigger-crowi-plus-docker.sh
  2. 1 15
      wercker.yml

+ 38 - 0
bin/wercker/trigger-crowi-plus-docker.sh

@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Trigger a new run
+# see: http://devcenter.wercker.com/docs/api/endpoints/runs#trigger-a-run
+
+# exec curl
+#
+# require
+#   - $WERCKER_TOKEN
+#   - $TARGET_PIPELINE_ID
+#   - $RELEASE_VERSION
+#
+RESPONSE=`curl -X POST \
+  -H "Content-Type: application/json" \
+  -H "Authorization: Bearer $WERCKER_TOKEN" \
+  https://app.wercker.com/api/v3/runs -d '{ \
+    "pipelineId": "$TARGET_PIPELINE_ID", \
+    "branch": "release", \
+    "envVars": [ \
+      { \
+        "key": "RELEASE_VERSION", \
+        "value": "$RELEASE_VERSION" \
+      } \
+    ] \
+  }'
+`
+
+echo $RESPONSE | jq .
+
+# get http status code
+STATUS_CODE=`echo $RESPONSE | jq .statusCode`
+
+# exit
+if [ "$STATUS_CODE" = 200 ]; then
+  exit 0
+else
+  exit 1
+fi

+ 1 - 15
wercker.yml

@@ -107,18 +107,4 @@ trigger-crowi-plus-docker:
   steps:
     - script:
       name: trigger crowi-plus-docker release pipeline
-      code: curl -X POST
-        -H "Content-Type: application/json"
-        -H "Authorization: Bearer $WERCKER_TOKEN"
-        https://app.wercker.com/api/v3/runs
-        -d
-        '{
-          "pipelineId": "$TARGET_PIPELINE_ID",
-          "branch": "release",
-          "envVars": [
-            {
-              "key": "RELEASE_VERSION",
-              "value": "$RELEASE_VERSION"
-            }
-          ]
-        }'
+      code: sh ./bin/wercker/trigger-crowi-plus-docker.sh