diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 2cd20e5c..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,113 +0,0 @@ ---- -# These environment variables must be set in CircleCI UI -# -# DOCKERHUB_REPO - docker hub repo, format: / -# DOCKER_USER - login info for docker hub -# DOCKER_PASS -version: 2.1 -jobs: - main: - docker: - - image: cimg/base:2024.01 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - environment: - APP_NAME: "socorro_collector" - steps: - - checkout - - - setup_remote_docker: - version: docker24 - docker_layer_caching: true - - - run: - name: Get info - command: | - uname -v - docker info - - - run: - name: Create version.json - # yamllint disable rule:line-length - command: | - # create a version.json per https://github.com/mozilla-services/Dockerflow/blob/master/docs/version_object.md - printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build":"%s"}\n' \ - "$CIRCLE_SHA1" \ - "$CIRCLE_TAG" \ - "$CIRCLE_PROJECT_USERNAME" \ - "$CIRCLE_PROJECT_REPONAME" \ - "$CIRCLE_BUILD_URL" > version.json - # yamllint enable rule:line-length - - - run: - name: Login to Dockerhub - # yamllint disable rule:line-length - command: | - if [ "${DOCKER_USER}" == "" ] || [ "${DOCKER_PASS}" == "" ]; then - echo "Skipping Login to Dockerhub, credentials not available." - else - echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin - fi - # yamllint enable rule:line-length - - - run: - name: Build Docker image - command: | - make build - - - run: - name: Verify requirements.txt file - command: | - docker compose run --rm --no-deps ci shell ./bin/run_verify_reqs.sh - - - run: - name: Lint - command: | - make my.env - docker-compose run --rm --no-deps ci shell ./bin/run_lint.sh - - - run: - name: Run tests - command: | - make my.env - docker-compose up --detach --no-color \ - localstack \ - statsd \ - fakesentry - docker-compose run --rm ci shell ./bin/run_tests.sh - - - run: - name: Run systemtest - command: | - docker compose run --rm ci-web shell ./bin/run_setup.sh - docker compose up --detach --wait --wait-timeout=10 ci-web - docker compose run --rm ci-web shell bash -c 'cd systemtest && NGINX_TESTS=0 POST_CHECK=1 HOST=http://ci-web:8000 pytest -vv' - - - run: - name: Run systemtest with pubsub and gcs - command: | - echo 'CRASHMOVER_CRASHPUBLISH_CLASS=antenna.ext.pubsub.crashpublish.PubSubCrashPublish' >> my.env - echo 'CRASHMOVER_CRASHSTORAGE_CLASS=antenna.ext.gcs.crashstorage.GcsCrashStorage' >> my.env - docker compose run --rm ci-web shell ./bin/run_setup.sh - docker compose up --detach --wait --wait-timeout=10 ci-web - # Use -m "not aws" to select gcp and unmarked tests - docker compose run --rm ci-web shell bash -c 'cd systemtest && NGINX_TESTS=0 POST_CHECK=1 HOST=http://ci-web:8000 pytest -vv -m "not aws"' - # remove config on last two lines - sed '$d' -i my.env - sed '$d' -i my.env - - - run: - name: Push to Dockerhub - command: | - bin/circleci_push.sh "local/antenna_deploy_base:latest" - -workflows: - version: 2 - - build_test_push: - jobs: - - main: - filters: - tags: - only: /v.*/ diff --git a/bin/circleci_push.sh b/bin/circleci_push.sh deleted file mode 100755 index 8ed2fe90..00000000 --- a/bin/circleci_push.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# Usage: bin/circleci-push.sh [LOCALIMAGE] -# -# Note: Don't use this--it's only used in CI. -# -# Environment variables used: -# -# DOCKER_USER/DOCKER_PASS: dockerhub credentials -# DOCKERHUB_REPO: name of the repo on dockerhub to use -# CIRCLE_BRANCH/CIRCLE_TAG: CircleCI generated environment variables - -set -euo pipefail - -function retry { - set +e - local n=0 - local max=3 - while true; do - "$@" && break || { - if [[ $n -lt $max ]]; then - ((n++)) - echo "Command failed. Attempt $n/$max:" - else - echo "Failed after $n attempts." - exit 1 - fi - } - done - set -e -} - -if [[ $# -eq 0 ]]; then - echo "Usage: bin/circleci_push.sh [LOCALIMAGE]" - exit 1 -fi - -LOCAL_IMAGE="$1" - -if [ -z "${DOCKER_USER:-}" ] || [ -z "${DOCKER_PASS:-}" ] || [ -z "${DOCKERHUB_REPO:-}"]; then - echo "Skipping Login to Dockerhub, credentials not available." - exit -fi - -echo "${DOCKER_PASS}" | docker login -u="${DOCKER_USER}" --password-stdin - -if [ "${CIRCLE_BRANCH:-}" == "main" ]; then - # deploy main latest - REMOTE_IMAGE="${DOCKERHUB_REPO}:latest" -elif [ -n "${CIRCLE_TAG:-}" ]; then - # deploy a release tag - REMOTE_IMAGE="${DOCKERHUB_REPO}:${CIRCLE_TAG}" -else - echo "Build neither for the main branch nor for a tag, skipping Docker upload." - exit -fi - -echo "Pushing ${REMOTE_IMAGE}..." -docker tag "${LOCAL_IMAGE}" "${REMOTE_IMAGE}" -docker images -retry docker push "${REMOTE_IMAGE}"