diff --git a/.circleci/config.yml b/.circleci/config.yml index 6554e1f4..922005fc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,10 +17,46 @@ jobs: - run: name: "Say hello" command: "echo Hello, World!" + build_and_deploy: + docker: + - image: 'cimg/base:stable' + steps: + - checkout + - cloudrun/init + - cloudrun/build: + tag: 'gcr.io/${GOOGLE_PROJECT_ID}/test-${CIRCLE_SHA1}' + - cloudrun/deploy: + image: 'gcr.io/${GOOGLE_PROJECT_ID}/test-${CIRCLE_SHA1}' + platform: managed + region: eu-west1 + service-name: example-service + unauthenticated: true + - run: + command: > + # A simple example of how a deployed managed service could be + verified or further tested. + + # This step will send request our "API" and fail if there is + unexpected output. + GCP_API_RESULTS=$(curl -s "$GCP_DEPLOY_ENDPOINT") + + if [ "$GCP_API_RESULTS" != "Hello World!" ]; then + echo "Result is unexpected" + echo 'Result: ' + curl -s "$GCP_DEPLOY_ENDPOINT" + exit 1; + fi + name: Test managed deployed service. + +orbs: + cloudrun: circleci/gcp-cloud-run@1.0.2 +workflows: + build_and_deploy_to_managed_workflow: + jobs: + - build_and_deploy # Invoke jobs via workflows # See: https://circleci.com/docs/2.0/configuration-reference/#workflows -workflows: say-hello-workflow: jobs: - say-hello diff --git a/.gitignore b/.gitignore index c443d5e2..9ae882d3 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,10 @@ hs_err_pid* *.DS_Store node_modules/* node_modules +node_modules/.package-lock.json .vscode .idea +build/ +dist/