Skip to content

Add ci wait subcommand

Andy Cobaugh requested to merge feature/ci_wait into develop

This adds a ci wait subcommand, which will discover the version endpoint for a given project, and wait for it to update before exiting 0, or exit 1 if it exhausts the retries.

Example:

% CI_COMMIT_SHA=268de23asfasfd CI_PROJECT_NAME=psuid-service ./dist/devtool_linux_amd64/devtool ci wait -i foo -e develop                                                                                    
Error reading config file: Config File ".devtool" Not Found in "[/home/acobaugh]"
__________  _____________ ___      .___             __                .__
\______   \/   _____/    |   \   __| _/_______  ___/  |_  ____   ____ |  |
 |     ___/\_____  \|    |   /  / __ |/ __ \  \/ /\   __\/  _ \ /  _ \|  |
 |    |    /        \    |  /  / /_/ \  ___/\   /  |  | (  <_> |  <_> )  |__
 |____|   /_______  /______/   \____ |\___  >\_/   |__|  \____/ \____/|____/
                  \/                \/    \/
  • Waiting for new version to be available commit=268de23asfasfd env=develop project=psuid-service version=
  • Looking for version endpoint delay=10s maxtries=10
    • Checking URL: https://develop-psuid-service.qa.k8s.psu.edu/psuid-service-web/resources/version try=1
    • No version endpoint here  code=404
    • Checking URL: https://develop-psuid-service.qa.k8s.psu.edu/psuid-service/resources/version try=1
    • Found version endpoint    code=200
  • Waiting for version update delay=10s env=develop maxtries=30 project=psuid-service url=https://develop-psuid-service.qa.k8s.psu.edu/psuid-service/resources/version
    • Checking URL: https://develop-psuid-service.qa.k8s.psu.edu/psuid-service/resources/version try=1
    • Received response         code=200
    • New version is live

Usage:

Wait for a deployment to be deployed by watching the live version endpoint

Usage:
  devtool ci wait [flags]

Flags:
  -h, --help                    help for wait
      --timeout duration        Time to wait for every HTTP request (default 2s)
      --update-delay duration   Time to wait between checking version endpoint for update (default 10s)
      --update-max-tries int    Max tries to check version endpoint for the update (default 30)
      --url-delay duration      Time to wait between attempts to locate version endpoint (default 10s)
      --url-max-tries int       Max tries to locate the version endpoint (default 10)
  -u, --urls strings            List of URL templates to check in order to find version endpoint (default [https://{{.Env}}-{{.Project}}.qa.k8s.psu.edu/{{.Project}}-web/resources/version,https://{{.Env}}-{{.Project}}.qa.k8s.psu.edu/{{.Project}}/resources/version,https://{{.Env}}-{{.Project}}.qa.k8s.psu.edu/resources/version,https://{{.Env}}-{{.Project}}.qa.k8s.psu.edu/version])

Global Flags:
      --config string        config file (default is $HOME/.devtool.yaml)
  -e, --environment string   environment suffix to append to helm release name
  -i, --image-tag string     image tag for docker

Merge request reports