Skip to content

Commit

Permalink
introduce mage to run some commands and fix version command
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Panato <[email protected]>
  • Loading branch information
cpanato committed Feb 25, 2022
1 parent a53ce78 commit 27e8b94
Show file tree
Hide file tree
Showing 9 changed files with 594 additions and 17 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,19 @@ jobs:
go-version: '1.17.x'

- name: build
run: go build -o apko ./cmd/apko/main.go
run: |
go run mage.go buildLocal
./apko version
- uses: goreleaser/goreleaser-action@79d4afbba1b4eff8b9a98e3d2e58c4dbaf094e2b # v2.8.1
with:
version: v1.5.0
install-only: true

- name: snapshot
run: |
go run mage.go snapshot
./dist/apko-build_linux_amd64/apko version
test:
name: test
Expand All @@ -31,4 +43,4 @@ jobs:
go-version: '1.17.x'

- name: test
run: go test ./...
run: go run mage.go test
2 changes: 1 addition & 1 deletion .github/workflows/mink-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Build and install apko task
run: |
ko apply -BRf config/
go run mage.go koApply
- name: Build examples
run: |
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ jobs:
- uses: sigstore/cosign-installer@179e0f15e70e22ca2e7254fc12d68a9fbab35614 # v2.0.1
- uses: goreleaser/goreleaser-action@79d4afbba1b4eff8b9a98e3d2e58c4dbaf094e2b # v2.8.1
with:
version: latest
args: release --rm-dist
version: v1.5.0
install-only: true
- name: Release
run: go run mage.go release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -40,8 +42,6 @@ jobs:

env:
KO_DOCKER_REPO: ghcr.io/${{ github.repository }}
KOFLAGS: --platform=all --bare
COSIGN_EXPERIMENTAL: "true"

steps:
- uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492 # v2.2.0
Expand All @@ -59,7 +59,4 @@ jobs:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
- name: Publish/Sign apko image
run: |
DIGEST=$(ko build ${KOFLAGS} --tags $(basename "${{ github.ref }}" ) ./cmd/apko)
# TODO: Add attributes with version, sha, etc.
cosign sign ${DIGEST}
go run mage.go buildSignImages
6 changes: 6 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ builds:
- "386"
- amd64
- arm64
flags:
- -trimpath
mod_timestamp: '{{ .CommitTimestamp }}'
ldflags:
- -extldflags "-static"
- "{{ .Env.LDFLAGS }}"

signs:
- id: apko-cosign
Expand Down
12 changes: 12 additions & 0 deletions .ko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,15 @@
baseImageOverrides:
# TODO(mattmoor): Talk to kaniini about the best image to use here.
chainguard.dev/apko/cmd/apko: docker.io/alpine:latest

builds:
- id: apko
dir: .
main: ./cmd/apko
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -extldflags "-static"
- "{{ .Env.LDFLAGS }}"
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220216180153-3d7835abdf40
github.com/chrismellard/docker-credential-acr-env v0.0.0-20220119192733-fe33c00cee21
github.com/google/go-containerregistry v0.8.1-0.20220223122423-dd8d514a9b24
github.com/magefile/mage v1.11.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.3.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
Expand All @@ -17,7 +18,7 @@ require (
github.com/Azure/azure-sdk-for-go v46.4.0+incompatible // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.8 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.4 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.5 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.2 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.1 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
Expand All @@ -36,16 +37,17 @@ require (
github.com/aws/smithy-go v1.6.0 // indirect
github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be // indirect
github.com/containerd/stargz-snapshotter/estargz v0.11.0 // indirect
github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect
github.com/dimchansky/utfbom v1.1.0 // indirect
github.com/docker/cli v20.10.12+incompatible // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v20.10.12+incompatible // indirect
github.com/docker/docker-credential-helpers v0.6.4 // indirect
github.com/form3tech-oss/jwt-go v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.14.2 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 // indirect
Expand All @@ -59,4 +61,5 @@ require (
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gotest.tools/v3 v3.0.3 // indirect
)
Loading

0 comments on commit 27e8b94

Please sign in to comment.