diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4a30b9a5..84a2c9a4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,6 +22,14 @@ jobs: # These secrets will need to be configured for the repository: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + - name: Login to Public ECR + uses: docker/login-action@v1 + with: + registry: public.ecr.aws + username: ${{ secrets.AWS_ACCESS_KEY_ID }} + password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + env: + AWS_REGION: us-east-1 - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: @@ -33,35 +41,3 @@ jobs: # GitHub sets this automatically GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} - release-docker: - name: Release Docker Image - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Login to Public ECR - uses: docker/login-action@v1 - with: - registry: public.ecr.aws - username: ${{ secrets.AWS_ACCESS_KEY_ID }} - password: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - env: - AWS_REGION: us-east-1 - - name: Build & Push - run: | - git fetch --tags --force - TAG=$(git describe --tags --match "v[0-9].*" --always) - IMAGE="kubectl-opslevel:${TAG}" - docker build -t ${IMAGE} --build-arg VERSION=$(git describe --tags --long --abbrev=12 --match "v[0-9].*" --always) . - - AWS_IMAGE="public.ecr.aws/e1n4f2i6/kubectl-opslevel:${TAG}" - docker tag ${IMAGE} ${AWS_IMAGE} - docker push ${AWS_IMAGE} - - echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin - GITHUB_IMAGE="docker.pkg.github.com/opslevel/kubectl-opslevel/main:${TAG}" - docker tag ${IMAGE} ${GITHUB_IMAGE} - docker push ${GITHUB_IMAGE} - diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 988ae739..00000000 --- a/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM golang:1.16 AS builder -ARG VERSION=development -LABEL stage=builder -WORKDIR /workspace -COPY ./src/go.mod . -COPY ./src/go.sum . -RUN go mod download -COPY ./src . -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./kubectl-opslevel -ldflags="-X 'github.com/opslevel/kubectl-opslevel/cmd.version=${VERSION}'" - - -FROM ubuntu:impish AS release -ENV USER_UID=1001 USER_NAME=opslevel -ENTRYPOINT ["/usr/local/bin/kubectl-opslevel"] -WORKDIR /app -RUN apt-get update && \ - apt-get install -y curl && \ - apt-get purge && apt-get clean && apt-get autoclean && \ - curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 && \ - chmod +x /usr/local/bin/jq -COPY --from=builder /workspace/kubectl-opslevel /usr/local/bin/ - diff --git a/skaffold.yaml b/skaffold.yaml deleted file mode 100644 index 2c14ff67..00000000 --- a/skaffold.yaml +++ /dev/null @@ -1,28 +0,0 @@ -apiVersion: skaffold/v2beta16 -kind: Config -metadata: - name: opslevel -build: - artifacts: - - image: public.ecr.aws/e1n4f2i6/kubectl-opslevel - docker: - dockerfile: Dockerfile - -deploy: - kubectl: - manifests: - - test/k8s/*.yaml - helm: - releases: - - name: localdev - namespace: opslevel - createNamespace: true - repo: https://opslevel.github.io/helm-charts - remoteChart: kubernetes-sync - valuesFiles: - - ./values.yaml - setFiles: - sync.config: ./opslevel-k8s.yaml - artifactOverrides: - image: public.ecr.aws/e1n4f2i6/kubectl-opslevel # no tag present! - # Skaffold continuously tags your image, so no need to put one here. \ No newline at end of file diff --git a/src/.goreleaser.yml b/src/.goreleaser.yml index f2d470d8..6fa84a52 100644 --- a/src/.goreleaser.yml +++ b/src/.goreleaser.yml @@ -28,6 +28,14 @@ archives: format_overrides: - goos: windows format: zip +dockers: + - image_templates: + - "public.ecr.aws/opslevel/kubectl-opslevel:here{{ .Tag }}" + build_flag_templates: + - "--label=org.opencontainers.image.created={{ .Date }}" + - "--label=org.opencontainers.image.revision={{ .FullCommit }}" + - "--label=org.opencontainers.image.version={{ .Tag }}" + - "--build-arg=VERSION={{ .Tag }}" brews: - name: kubectl homepage: "https://www.opslevel.com/" @@ -45,7 +53,17 @@ brews: name: homebrew-tap token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" checksum: - name_template: '{{ .ProjectName }}.sha256' + name_template: '{{ .ProjectName }}_SHA256SUMS' algorithm: sha256 +signs: + - artifacts: checksum + args: + - "--batch" + - "--local-user" + - "{{ .Env.GPG_FINGERPRINT }}" + - "--output" + - "${signature}" + - "--detach-sign" + - "${artifact}" changelog: skip: true diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 00000000..a41bc86f --- /dev/null +++ b/src/Dockerfile @@ -0,0 +1,10 @@ +FROM ubuntu:impish AS release +ENV USER_UID=1001 USER_NAME=opslevel +ENTRYPOINT ["/kubectl-opslevel"] +WORKDIR /app +RUN apt-get update && \ + apt-get install -y curl && \ + apt-get purge && apt-get clean && apt-get autoclean && \ + curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 && \ + chmod +x /usr/local/bin/jq +COPY kubectl-opslevel /