# Doc: https://wiki.sc-corp.net/pages/viewpage.action?pageId=121500284
version: 1
machamp:
  keydb-build:
    # Optional - build counter is linked to the build def
    tag_template: "0.0.%build.counter%-%sha%"
    # Optional - value in seconds before a build is terminated, default is 3600 seconds
    timeout: 3600
    # Optional - update ghe or not, default to true
    update_ghe: true
    code_coverage: false
    # Required
    steps:
      make-build:
        type: cmd
        # https://github.sc-corp.net/Snapchat/img/tree/master/keydb/ubuntu-20-04
        builder_image: us.gcr.io/snapchat-build-artifacts/prod/snapchat/img/keydb/keydb-ubuntu-20-04@sha256:cf869a3f5d1de1e1d976bb906689c37b7031938eb68661b844a38c532f27248c
        command: ./machamp_scripts/build.sh
      tls-test:
        type: cmd
        parent: make-build
        # https://github.sc-corp.net/Snapchat/img/tree/master/keydb/ubuntu-20-04
        builder_image: us.gcr.io/snapchat-build-artifacts/prod/snapchat/img/keydb/keydb-ubuntu-20-04@sha256:cf869a3f5d1de1e1d976bb906689c37b7031938eb68661b844a38c532f27248c
        command: ./runtest --clients 4 --verbose --tls
      cluster-test:
        type: cmd
        parent: make-build
        # https://github.sc-corp.net/Snapchat/img/tree/master/keydb/ubuntu-20-04
        builder_image: us.gcr.io/snapchat-build-artifacts/prod/snapchat/img/keydb/keydb-ubuntu-20-04@sha256:cf869a3f5d1de1e1d976bb906689c37b7031938eb68661b844a38c532f27248c
        command: ./runtest-cluster --tls
      sentinel-test:
        type: cmd
        parent: make-build
        # https://github.sc-corp.net/Snapchat/img/tree/master/keydb/ubuntu-20-04
        builder_image: us.gcr.io/snapchat-build-artifacts/prod/snapchat/img/keydb/keydb-ubuntu-20-04@sha256:cf869a3f5d1de1e1d976bb906689c37b7031938eb68661b844a38c532f27248c
        command: ./runtest-sentinel
      module-test:
        type: cmd
        parent: make-build
        # https://github.sc-corp.net/Snapchat/img/tree/master/keydb/ubuntu-20-04
        builder_image: us.gcr.io/snapchat-build-artifacts/prod/snapchat/img/keydb/keydb-ubuntu-20-04@sha256:cf869a3f5d1de1e1d976bb906689c37b7031938eb68661b844a38c532f27248c
        command: ./runtest-moduleapi
      rotation-test:
        type: cmd
        parent: make-build
        # https://github.sc-corp.net/Snapchat/img/tree/master/keydb/ubuntu-20-04
        builder_image: us.gcr.io/snapchat-build-artifacts/prod/snapchat/img/keydb/keydb-ubuntu-20-04@sha256:cf869a3f5d1de1e1d976bb906689c37b7031938eb68661b844a38c532f27248c
        command: ./runtest-rotation
  keydb-docker-build:
    # Optional - build counter is linked to the build def
    tag_template: "%sha%"
    # Optional - value in seconds before a build is terminated, default is 3600 seconds
    timeout: 3600
    # Optional - update ghe or not, default to true
    update_ghe: true
    code_coverage: false
    # Required
    steps:
      # to ensure a clearer docker build env
      code-checkout:
        type: cmd
        command: echo checkout
        # default machamp builder image does not work for multi arch
        builder_image: us.gcr.io/snapchat-build-artifacts/prod/snapchat/img/ubuntu/ubuntu-23-04@sha256:bd43177a80e6ce1c3583e8ea959b88a9081c0f56b765ec9c5a157c27a637c23b
      docker:
        parent: code-checkout
        type: docker # published images can be found in https://console.cloud.google.com/gcr/images/machamp-prod/global/keydb
        dockerfile: machamp_scripts/Dockerfile
        image_name: keydb # git commit sha will be deafult tag in the final image
        workspace_context: ./ # This is the workspace context that your Dockerfile will use to move files around. <Root of checkout repository>/<Workspace Context>/<Dockerfile> If the workspace context is just the root of the repository, you can just use "./".
