version: 2
jobs:
  e2e:
    docker:
    - image: cimg/go:1.22 # If you update this, update it in the Makefile too
      environment:
        # This version of TF will be downloaded before Atlantis is started.
        # We do this instead of setting --default-tf-version because setting
        # that flag starts the download asynchronously so we'd have a race
        # condition.
        # renovate: datasource=github-releases depName=hashicorp/terraform versioning=hashicorp
        TERRAFORM_VERSION: 1.7.4
    steps:
    - checkout
    - run: make build-service
    # We don't run e2e tests on fork PRs because they don't have access to the secret env vars.
    - run: if [ -z "${CIRCLE_PR_REPONAME}" ]; then ./scripts/e2e.sh; fi

workflows:
  version: 2
  branch:
    jobs:
    - e2e:
        context:
          - atlantis-e2e-tests
        filters:
          branches:
            # Ignore fork PRs since they don't have access to
            # the atlantis-e2e-tests context (and also doc PRs).
            ignore: /(pull\/\d+)|(docs\/.*)/
