From 2dd7061062b3e3ef3834be5c1d5cede9b18b644d Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Thu, 25 Apr 2024 22:34:34 -0400 Subject: [PATCH 1/2] ci: remove circle ci config --- .circleci/config.yml | 468 ------------------------------------------- 1 file changed, 468 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 3abda0ab5..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,468 +0,0 @@ -version: 2 - -jobs: - bot_test: - docker: - - image: python:3.7-slim - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - - image: circleci/redis:5.0 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - run: - name: install git - command: | - apt update - apt install -y git - - checkout - - run: - name: skip build if no changes - command: | - ./s/stop_ci_if_no_changes bot/ - # https://circleci.com/docs/2.0/caching/ - - restore_cache: - keys: - - bot-v1-{{ checksum "bot/poetry.lock" }} - - run: - name: install dependencies - working_directory: bot - command: | - # Use our new PATH so we can call poetry from bash - echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV - source $BASH_ENV - command -v poetry || python -m pip install --user poetry==1.1.13 - poetry config virtualenvs.in-project true - poetry install - - save_cache: - paths: - - ./bot/.mypy_cache - - /root/.cache/ - key: bot-v1-{{ checksum "bot/poetry.lock" }} - - run: - name: run tests - working_directory: bot - command: ./s/test - - run: - name: upload code coverage - working_directory: bot - command: ./s/upload-code-cov - - bot_lint: - docker: - - image: python:3.7 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - run: - name: skip build if no changes - command: | - ./s/stop_ci_if_no_changes bot/ - # https://circleci.com/docs/2.0/caching/ - - restore_cache: - keys: - - bot-v1-{{ checksum "bot/poetry.lock" }} - - run: - name: install dependencies - working_directory: bot - command: | - # Use our new PATH so we can call poetry from bash - echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV - source $BASH_ENV - command -v poetry || python -m pip install --user poetry==1.1.13 - poetry config virtualenvs.in-project true - poetry install - - save_cache: - paths: - - ./bot/.mypy_cache - - /root/.cache/ - key: bot-v1-{{ checksum "bot/poetry.lock" }} - - run: - name: run lints - working_directory: bot - command: ./s/lint - - # https://circleci.com/docs/2.0/building-docker-images/ - bot_build_container: - docker: - - image: docker:20.10.23 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - setup_remote_docker - - run: - name: build container - working_directory: bot - command: ./s/build - - docs_typecheck: - docker: - - image: circleci/node:12.4.0 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - run: - name: skip build if no changes - command: | - ./s/stop_ci_if_no_changes docs/ - - restore_cache: - keys: - - docs-site-v1-{{ checksum "docs/yarn.lock" }} - - run: - name: install dependencies - working_directory: docs - command: | - yarn install --frozen-lockfile --non-interactive - - save_cache: - paths: - - ./docs/node_modules - key: docs-site-v1-{{ checksum "docs/yarn.lock" }} - - run: - name: run typechecker - working_directory: docs - command: s/typecheck - - docs_fmt: - docker: - - image: circleci/node:12.4.0 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - run: - name: skip build if no changes - command: | - ./s/stop_ci_if_no_changes docs/ - - restore_cache: - keys: - - docs-site-v1-{{ checksum "docs/yarn.lock" }} - - run: - name: install dependencies - working_directory: docs - command: yarn install --frozen-lockfile --non-interactive - - save_cache: - paths: - - ./docs/node_modules - key: docs-site-v1-{{ checksum "docs/yarn.lock" }} - - run: - name: run fmt - working_directory: docs - command: s/fmt-ci - - docs_build: - docker: - - image: circleci/node:12.4.0 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - run: - name: skip build if no changes - command: | - ./s/stop_ci_if_no_changes docs/ - - restore_cache: - keys: - - docs-site-v1-{{ checksum "docs/yarn.lock" }} - - run: - name: install dependencies - working_directory: docs - command: yarn install --frozen-lockfile --non-interactive - - save_cache: - paths: - - ./docs/node_modules - key: docs-site-v1-{{ checksum "docs/yarn.lock" }} - - run: - name: build - working_directory: docs - command: s/build - - web_api_test: - docker: - - image: python:3.7 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - - image: circleci/postgres:12-ram - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - environment: - POSTGRES_DB: web_api_test - POSTGRES_PASSWORD: my_test_postgres_password - - image: circleci/redis:5.0 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - environment: - DATABASE_URL: postgres://postgres:my_test_postgres_password@127.0.0.1:5432/web_api_test - steps: - - checkout - - run: - name: skip build if no changes - command: | - ./s/stop_ci_if_no_changes web_api/ - # https://circleci.com/docs/2.0/caching/ - - restore_cache: - keys: - - web_api-v1-{{ checksum "web_api/poetry.lock" }} - - run: - name: install dependencies - working_directory: web_api - command: | - # Use our new PATH so we can call poetry from bash - echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV - source $BASH_ENV - command -v poetry || python -m pip install --user poetry==1.1.9 - poetry config virtualenvs.in-project true - poetry install - - save_cache: - paths: - - ./web_api/.mypy_cache - - /root/.cache/ - key: web_api-v1-{{ checksum "web_api/poetry.lock" }} - - run: - name: run tests - working_directory: web_api - command: ./s/test - - run: - name: upload code coverage - working_directory: web_api - command: ./s/upload-code-cov - - web_api_lint: - docker: - - image: python:3.7 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - run: - name: skip build if no changes - command: | - ./s/stop_ci_if_no_changes web_api/ - # https://circleci.com/docs/2.0/caching/ - - restore_cache: - keys: - - web_api-v1-{{ checksum "web_api/poetry.lock" }} - - run: - name: install dependencies - working_directory: web_api - command: | - # Use our new PATH so we can call poetry from bash - echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV - source $BASH_ENV - command -v poetry || python -m pip install --user poetry==1.1.9 - poetry config virtualenvs.in-project true - poetry install - - save_cache: - paths: - - ./web_api/.mypy_cache - - /root/.cache/ - key: web_api-v1-{{ checksum "web_api/poetry.lock" }} - - run: - name: run lints - working_directory: web_api - command: ./s/lint - - web_api_squawk: - docker: - - image: python:3.7 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - - image: circleci/postgres:12-ram - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - environment: - POSTGRES_DB: web_api_test - POSTGRES_PASSWORD: my_test_postgres_password - environment: - DATABASE_URL: postgres://postgres:my_test_postgres_password@127.0.0.1:5432/web_api_test - steps: - - checkout - - run: - name: skip build if no changes - command: | - ./s/stop_ci_if_no_changes web_api/ - # https://circleci.com/docs/2.0/caching/ - - restore_cache: - keys: - - web_api-v1-{{ checksum "web_api/poetry.lock" }} - - run: - name: install dependencies - working_directory: web_api - command: | - # Use our new PATH so we can call poetry from bash - echo 'export PATH="$PATH":"$HOME"/.local/bin' >> $BASH_ENV - source $BASH_ENV - command -v poetry || python -m pip install --user poetry==1.1.9 - poetry config virtualenvs.in-project true - poetry install - - save_cache: - paths: - - ./web_api/.mypy_cache - - /root/.cache/ - key: web_api-v1-{{ checksum "web_api/poetry.lock" }} - - run: - name: "install nodejs" - command: | - curl -sL https://deb.nodesource.com/setup_14.x | bash - - apt-get install -y nodejs - - run: - name: run squawk - working_directory: web_api - command: ./s/squawk.py - - # https://circleci.com/docs/2.0/building-docker-images/ - web_api_build_container: - docker: - - image: docker:18.05.0-ce - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - setup_remote_docker - - run: - name: build container - working_directory: web_api - command: ./s/build - - web_ui_lint: - docker: - - image: circleci/node:12.4.0 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - run: - name: skip build if no changes - command: | - ./s/stop_ci_if_no_changes web_ui/ - - restore_cache: - keys: - - web-ui-v1-{{ checksum "web_ui/yarn.lock" }} - - run: - name: install dependencies - working_directory: web_ui - command: yarn install --frozen-lockfile --non-interactive - - save_cache: - paths: - - ./web_ui/node_modules - key: docs-site-v1-{{ checksum "web_ui/yarn.lock" }} - - run: - name: lint - working_directory: web_ui - command: ./s/lint - - web_ui_test: - docker: - - image: circleci/node:12.4.0 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - run: - name: skip build if no changes - command: | - ./s/stop_ci_if_no_changes web_ui/ - - restore_cache: - keys: - - web-ui-v1-{{ checksum "web_ui/yarn.lock" }} - - run: - name: install dependencies - working_directory: web_ui - command: yarn install --frozen-lockfile --non-interactive - - save_cache: - paths: - - ./web_ui/node_modules - key: docs-site-v1-{{ checksum "web_ui/yarn.lock" }} - - run: - name: test - working_directory: web_ui - command: ./s/test - - shellcheck: - docker: - - image: ubuntu:18.04 - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - run: - name: install dependencies - command: | - apt-get update - apt-get install -y git shellcheck - - run: - name: run shellcheck - command: | - ./s/shellcheck - - # https://circleci.com/docs/2.0/building-docker-images/ - web_ui_build_container: - docker: - - image: docker:18.05.0-ce - auth: - username: $DOCKER_USER - password: $DOCKER_PASS - steps: - - checkout - - setup_remote_docker - - run: - name: build container - working_directory: web_ui - command: ./s/build - -workflows: - version: 2 - all: - jobs: - - shellcheck - bot: - jobs: - - bot_test - - bot_lint - - bot_build_container: - filters: - tags: - only: /^v\d*\.\d*\.\d*$/ - docs: - jobs: - - docs_typecheck - - docs_fmt - - docs_build - - web_ui: - jobs: - - web_ui_lint - - web_ui_test - - web_ui_build_container: - filters: - tags: - only: /^v\d*\.\d*\.\d*$/ - - web_api: - jobs: - - web_api_test - - web_api_lint - - web_api_squawk - - web_api_build_container: - filters: - tags: - only: /^v\d*\.\d*\.\d*$/ From 8ba6e7d4695135c7f326e2ff0b05a331529d18f5 Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Thu, 25 Apr 2024 22:37:42 -0400 Subject: [PATCH 2/2] fix --- README.md | 4 +-- bot/s/build | 15 ---------- s/stop_ci_if_no_changes | 65 ----------------------------------------- web_api/s/build | 15 ---------- web_ui/s/build | 15 ---------- 5 files changed, 2 insertions(+), 112 deletions(-) delete mode 100755 bot/s/build delete mode 100755 s/stop_ci_if_no_changes delete mode 100755 web_api/s/build delete mode 100755 web_ui/s/build diff --git a/README.md b/README.md index ff4500a38..4cca1db09 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

-# kodiak [![CircleCI](https://circleci.com/gh/chdsbd/kodiak.svg?style=svg&circle-token=4879604a0cca6fa815c4d22936350f5bdf455905)](https://circleci.com/gh/chdsbd/kodiak) +# kodiak > A GitHub bot to automatically update and merge GitHub PRs @@ -24,8 +24,8 @@ _If you'd rather run Kodiak yourself, check out the [self hosting page](https:// View activity via the dashboard at . - ## Example + [![kodiak pull request flow](https://3c7446e0-cd7f-4e98-a123-1875fcbf3182.s3.amazonaws.com/marketplace+listing+image.svg)](https://github.com/marketplace/kodiakhq) Kodiak automatically updates branches, merges PRs and more! diff --git a/bot/s/build b/bot/s/build deleted file mode 100755 index 5ada66946..000000000 --- a/bot/s/build +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env sh -set -e -DOCKER_HUB_REPO='cdignam/kodiak' -docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" - -set -x - -# https://circleci.com/docs/2.0/env-vars/#circleci-built-in-environment-variables -LABEL="$CIRCLE_SHA1" -if [ -n "$CIRCLE_TAG" ]; then - LABEL="$CIRCLE_TAG" -fi - -docker build --tag "$DOCKER_HUB_REPO:$LABEL" . -docker push "$DOCKER_HUB_REPO:$LABEL" diff --git a/s/stop_ci_if_no_changes b/s/stop_ci_if_no_changes deleted file mode 100755 index 1f75780ee..000000000 --- a/s/stop_ci_if_no_changes +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python3 - -""" -If there have been no changes in the specified path, exit circleci job early. - - -We use the `circleci` CLI to stop the job early. -""" - -import os -import subprocess -import sys - -MAIN_BRANCH = "master" - - -def main(path: str) -> int: - # CircleCI's built in git checkout code clobbers the `master` ref so we do the - # following to make it not point to the current ref. - # https://discuss.circleci.com/t/git-checkout-of-a-branch-destroys-local-reference-to-master/23781/7 - if os.getenv("CIRCLECI") and os.getenv("CIRCLE_BRANCH") != MAIN_BRANCH: - subprocess.run( - [ - "git", - "branch", - "-f", - MAIN_BRANCH, - "origin/{branch}".format(branch=MAIN_BRANCH), - ], - check=True, - ) - - res = subprocess.run( - [ - "git", - "--no-pager", - "diff", - "--name-only", - "--exit-code", - "{branch}...".format(branch=MAIN_BRANCH), - path, - # we want to run our build whenever the CircleCI config changes - # because build environment changes could affect our tests - ".circleci/config.yml", - ], - stdout=subprocess.PIPE, - ) - file_names = res.stdout.decode().strip().splitlines() - # no changes on zero return code. - if res.returncode == 0: - print("no changes found. Skipping build.") - subprocess.run(["circleci", "step", "halt"], check=True) - elif res.returncode == 1: - print( - "changes found in files: {file_names!r}\nContinuing build.".format( - file_names=file_names - ) - ) - else: - raise ValueError("Unexpected return code {}".format(res.returncode)) - - -if __name__ == "__main__": - path = sys.argv[1] - sys.exit(main(path)) diff --git a/web_api/s/build b/web_api/s/build deleted file mode 100755 index 0ffb3e7d8..000000000 --- a/web_api/s/build +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env sh -set -e -DOCKER_HUB_REPO='cdignam/kodiak-web-api' -docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" - -set -x - -# https://circleci.com/docs/2.0/env-vars/#circleci-built-in-environment-variables -LABEL="$CIRCLE_SHA1" -if [ -n "$CIRCLE_TAG" ]; then - LABEL="$CIRCLE_TAG" -fi - -docker build --tag "$DOCKER_HUB_REPO:$LABEL" . -docker push "$DOCKER_HUB_REPO:$LABEL" diff --git a/web_ui/s/build b/web_ui/s/build deleted file mode 100755 index 2b7d88cc5..000000000 --- a/web_ui/s/build +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env sh -set -e -DOCKER_HUB_REPO='cdignam/kodiak-web-ui' -docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" - -set -x - -# https://circleci.com/docs/2.0/env-vars/#circleci-built-in-environment-variables -LABEL="$CIRCLE_SHA1" -if [ -n "$CIRCLE_TAG" ]; then - LABEL="$CIRCLE_TAG" -fi - -docker build --tag "$DOCKER_HUB_REPO:$LABEL" . -docker push "$DOCKER_HUB_REPO:$LABEL"