-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: cpanato <ctadeu@gmail.com>
- Loading branch information
Showing
5 changed files
with
107 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Ignore GoLand (IntelliJ) files. | ||
.idea/ | ||
|
||
imagerefs | ||
ko | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,52 @@ | ||
# This is an example goreleaser.yaml file with some sane defaults. | ||
--- | ||
# Make sure to check the documentation at http://goreleaser.com | ||
before: | ||
hooks: | ||
# you may remove this if you don't use vgo | ||
- go mod tidy | ||
# you may remove this if you don't need go generate | ||
- go generate ./... | ||
- /bin/bash -c 'if [ -n "$(git --no-pager diff --exit-code go.mod go.sum)" ]; then exit 1; fi' | ||
- /bin/bash -c './scripts/builld-sign-release-images.sh' | ||
|
||
builds: | ||
- main: ./main.go | ||
env: | ||
- CGO_ENABLED=0 | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- "-s -w -X github.com/google/ko/pkg/commands.Version={{.Version}}" | ||
goos: | ||
- windows | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- s390x | ||
- 386 | ||
- mips64le | ||
- ppc64le | ||
- main: ./main.go | ||
env: | ||
- CGO_ENABLED=0 | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- "-s -w -X github.com/google/ko/pkg/commands.Version={{.Version}}" | ||
goos: | ||
- windows | ||
- linux | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- s390x | ||
- 386 | ||
- mips64le | ||
- ppc64le | ||
|
||
archives: | ||
- replacements: | ||
darwin: Darwin | ||
linux: Linux | ||
windows: Windows | ||
386: i386 | ||
amd64: x86_64 | ||
- name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
|
||
changelog: | ||
sort: asc | ||
use: github | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
- '^docs:' | ||
- '^test:' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2020 Google LLC All Rights Reserved. | ||
# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2023 Google LLC All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
: "${GIT_HASH:?Environment variable empty or not defined.}" | ||
: "${GIT_TAG:?Environment variable empty or not defined.}" | ||
: "${RUN_ID:?Environment variable empty or not defined.}" | ||
: "${RUN_ATTEMPT:?Environment variable empty or not defined.}" | ||
|
||
export LDFLAGS="-s -w -X github.com/google/ko/pkg/commands.Version=${GIT_TAG}" | ||
|
||
ko build --bare --platform=all -t latest -t "${GIT_HASH}" -t "${GIT_TAG}" --image-refs imagerefs ./ | ||
|
||
if [[ ! -f imagerefs ]]; then | ||
echo "imagerefs not found" | ||
exit 1 | ||
fi | ||
|
||
echo "Signing images with Keyless..." | ||
readarray -t images < <(cat imagerefs || true) | ||
cosign sign --yes \ | ||
-a GIT_HASH="${GIT_HASH}" \ | ||
-a GIT_TAG="${GIT_TAG}" \ | ||
-a RUN_ID="${RUN_ID}" \ | ||
-a RUN_ATTEMPT="${RUN_ATTEMPT}" \ | ||
"${images[@]}" |