Przeglądaj źródła

hack: moved deployment to ECS (#58)

bohrasd 1 rok temu
rodzic
commit
2d8a41bfb8
1 zmienionych plików z 22 dodań i 3 usunięć
  1. 22 3
      hack/build-deploy-app.sh

+ 22 - 3
hack/build-deploy-app.sh

@@ -8,7 +8,26 @@ set -o pipefail
 source hack/get-tools.sh
 
 plantbuild push ./plantbuild/build.jsonnet
-plantbuild k8s_set_images ./plantbuild/images.jsonnet
 
-NAMESPACE="qor5-test"
-echo "kubectl -n $NAMESPACE get deploy -o name | xargs -n1 kubectl -n $NAMESPACE rollout status --timeout 150s" | $KUBECTL_BASH
+# https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-dispatch-event
+
+build_json=$(plantbuild show ./plantbuild/build.jsonnet | jq -r .services)
+output_json='{"event_type": "deploy-docs-test"}'
+for key in $(echo  "$build_json" | jq -r keys[]); do
+  app_name=$(echo "$key" | sed 's/build_image_//')
+  image=$( echo "$build_json" | jq -r --arg key "$key" '.[$key].image')
+  output_json=$(echo "$output_json" | jq -r \
+      --arg app_name "$app_name" \
+      --arg image "$image" \
+      '.client_payload.github[$app_name].image = $image')
+done
+
+echo $output_json | jq .
+
+curl -XPOST -H "Content-Type: application/json" \
+    -H "Accept:  application/vnd.github.everest-preview+json" \
+    -H "Authorization: Bearer $GITHUB_TOKEN" \
+    https://api.github.com/repos/theplant/qor5-provisioning/dispatches \
+    -d @- <<EOF
+$output_json
+EOF