From 4f7792ededfb783716b70c937cc9c90df852ea92 Mon Sep 17 00:00:00 2001 From: Dean Strelau Date: Fri, 24 Feb 2023 16:06:57 -0600 Subject: [PATCH] Revert "Merge pull request #1 from honeycombio/nl.circleci" This reverts commit 0b0200a03e1c81b363ed446c02a8bb36de347143, reversing changes made to 31dbacdbcd363ca6646b435e0a00835f1d783845. --- .circleci/config.yml | 92 ---------------------------------------- .github/workflows/ko.yml | 78 ++++++++++++++++++++++++++++++++++ README.md | 2 - 3 files changed, 78 insertions(+), 94 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ko.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 2953d0c..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,92 +0,0 @@ -version: 2.1 - -orbs: - aws-cli: circleci/aws-cli@2.1.0 - aws-ecr: circleci/aws-ecr@6.15.3 - go: circleci/go@1.7 - -commands: - fix_outdated_things: - steps: - - run: - name: Fix outdated things - command: | - export GO111MODULE=on - go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0 - go get -u golang.org/x/sys - - install_ko: - steps: - - run: - name: Install ko - command: | - # go install github.com/google/ko@latest - curl -sL https://github.com/google/ko/releases/download/v0.8.3/ko_0.8.3_Linux_arm64.tar.gz | tar -xzv ko || true - ./ko version # check that it installed; if not, this step will fail - setup: - steps: - - checkout: { path: kspan } - -jobs: - go_test: - machine: - image: ubuntu-2004:202101-01 - resource_class: arm.medium - docker_layer_caching: true - steps: - - setup - - fix_outdated_things - - run: - name: test go - command: | - set -x - cd kspan - make test - - deploy_docker: - machine: - image: ubuntu-2004:202101-01 - resource_class: arm.medium - docker_layer_caching: true - steps: - - setup - - aws-cli/setup: - aws-access-key-id: AWS_ACCESS_KEY_ID - aws-secret-access-key: AWS_SECRET_ACCESS_KEY - aws-region: AWS_REGION - - install_ko - - run: - name: build_docker_image - command: | - set -x - cd kspan; - export BUILD_ID="$(echo $(expr $CIRCLE_BUILD_NUM + 100000))" - echo BUILD_ID=$BUILD_ID - export TAG="$(test "${CIRCLE_BRANCH}" == "main" && echo "" || echo "branch-")${BUILD_ID}" - export ECR_HOST=702835727665.dkr.ecr.us-east-1.amazonaws.com - # ko adds /kspan to the end by itself - # yes this is scary, I don't like ko - export KO_DOCKER_REPO="${ECR_HOST}" - - aws ecr get-login-password --region us-east-1 \ - | docker login --username AWS --password-stdin "${ECR_HOST}" - - ../ko publish \ - --base-import-paths \ - --tags $TAG \ - --platform=linux/amd64,linux/arm64 \ - --push=true \ - . - -workflows: - version: 2 - build: - jobs: - - go_test: - name: go_test - - deploy_docker: - context: - - Honeycomb Secrets - filters: - branches: - ignore: /dependabot.*/ diff --git a/.github/workflows/ko.yml b/.github/workflows/ko.yml new file mode 100644 index 0000000..2675277 --- /dev/null +++ b/.github/workflows/ko.yml @@ -0,0 +1,78 @@ +--- +name: Ko + +on: [push, pull_request, create] # create is for tags + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Fix outdated things + run: | + go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0 + go get -u golang.org/x/sys + + + - name: Lint + uses: golangci/golangci-lint-action@v2 + with: + version: latest + args: --timeout=5m + + - name: Build + run: make + + - name: Test + run: make test + + - name: Install ko + run: | + # go install github.com/google/ko@latest + curl -sL https://github.com/google/ko/releases/download/v0.8.3/ko_0.8.3_Linux_x86_64.tar.gz | tar -xzv ko || true + ./ko version # check that it installed; if not, this step will fail + + - name: Set tags + id: tags + run: | + set -euo pipefail + set -x + TAGS="latest,${{ github.sha }}" + github_tag="$(echo ${{ github.ref }} | sed -n '/refs\/tags\//p' | sed 's|refs/tags/||')" + if [[ "${github_tag}" != "" ]]; then + TAGS="${TAGS},${github_tag}" + fi + echo "::set-output name=tags::$TAGS" + + - name: Build docker image + run: | + ./ko publish \ + --local \ + --base-import-paths \ + --tags ${{ steps.tags.outputs.tags }} \ + --platform=linux/amd64,linux/arm64 \ + . + + - name: Log in to the Container registry + if: startsWith( github.ref, 'refs/tags/' ) + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push docker image if this build was triggered by a tag + if: startsWith( github.ref, 'refs/tags/' ) + run: | + KO_DOCKER_REPO=ghcr.io/${{ github.repository_owner }} \ + ./ko publish \ + --base-import-paths \ + --tags ${{ steps.tags.outputs.tags }} \ + --platform=linux/amd64,linux/arm64 \ + . diff --git a/README.md b/README.md index 0176bee..31cea6b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # kspan - Turning Kubernetes Events into spans -Originally forked from https://github.com/ismith/kspan, itself a fork of https://github.com/puckpuck/kspan, itself a fork of https://github.com/weaveworks-experiments/kspan. - ## This project is a Work In Progress, under active evolution. Most Kubernetes components produce Events when something interesting happens.