mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
updated release scripts for kustomize
This commit is contained in:
@@ -1,29 +0,0 @@
|
|||||||
# This is an example goreleaser.yaml file with some sane defaults.
|
|
||||||
# Make sure to check the documentation at http://goreleaser.com
|
|
||||||
project_name: kustomize
|
|
||||||
builds:
|
|
||||||
- main: ./cmd/kustomize
|
|
||||||
binary: kustomize
|
|
||||||
ldflags: -s -X k8s.io/kubectl/cmd/kustomize/version.kustomizeVersion={{.Version}} -X k8s.io/kubectl/cmd/kustomize/version.gitCommit={{.Commit}} -X k8s.io/kubectl/cmd/kustomize/version.buildDate={{.Date}}
|
|
||||||
goos:
|
|
||||||
- darwin
|
|
||||||
- linux
|
|
||||||
- windows
|
|
||||||
env:
|
|
||||||
- CGO_ENABLED=0
|
|
||||||
archive:
|
|
||||||
wrap_in_directory: true
|
|
||||||
checksum:
|
|
||||||
name_template: 'checksums.txt'
|
|
||||||
snapshot:
|
|
||||||
name_template: "{{ .Tag }}-next"
|
|
||||||
changelog:
|
|
||||||
sort: asc
|
|
||||||
filters:
|
|
||||||
exclude:
|
|
||||||
- '^docs:'
|
|
||||||
- '^test:'
|
|
||||||
release:
|
|
||||||
github:
|
|
||||||
owner: droot
|
|
||||||
name: kubectl
|
|
||||||
@@ -1,16 +1,13 @@
|
|||||||
## Steps to run build locally
|
## Overview
|
||||||
|
|
||||||
Install container-builder-local from github and define GOOS, GOARCH, OUTPUT env
|
This directory contains scripts and configruation files for publishing a
|
||||||
variables and run following command
|
`kustomize` release on [release page](https://github.com/kubernetes-sigs/kustomize/releases)
|
||||||
|
|
||||||
|
## Steps to run build a release locally
|
||||||
|
Install container-builder-local from [github](https://github.com/GoogleCloudPlatform/container-builder-local).
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
container-builder-local --config=cmd/kustomize/build/cloudbuild_local.yaml --dryrun=false --substitutions=_GOOS=$GOOS,_GOARCH=$GOARCH --write-workspace=$OUTPUT .
|
container-builder-local --config=build/cloudbuild_local.yaml --dryrun=false --write-workspace=/tmp/w .
|
||||||
```
|
```
|
||||||
|
|
||||||
## Steps to submit build to Google container builder
|
You will find the build artifacts under `/tmp/w/dist` directory
|
||||||
|
|
||||||
You need to be at the repo level to be able to run the following command
|
|
||||||
|
|
||||||
```
|
|
||||||
gcloud container builds submit . --config=cmd/kustomize/build/cloudbuild.yaml --substitutions=_GOOS=$GOOS,_GOARCH=$GOARCH
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -23,20 +23,37 @@ set -x
|
|||||||
# - Use /go as the default GOPATH because this is what the image uses
|
# - Use /go as the default GOPATH because this is what the image uses
|
||||||
# - Link our current directory (containing the source code) to the package location in the GOPATH
|
# - Link our current directory (containing the source code) to the package location in the GOPATH
|
||||||
|
|
||||||
export PKG=k8s.io
|
OWNER="kubernetes-sigs"
|
||||||
export REPO=kubectl
|
REPO="kustomize"
|
||||||
export CMD=kustomize
|
|
||||||
|
|
||||||
GO_PKG_OWNER=$GOPATH/src/$PKG
|
GO_PKG_OWNER=$GOPATH/src/github.com/$OWNER
|
||||||
GO_PKG_PATH=$GO_PKG_OWNER/$REPO
|
GO_PKG_PATH=$GO_PKG_OWNER/$REPO
|
||||||
|
|
||||||
mkdir -p $GO_PKG_OWNER
|
mkdir -p $GO_PKG_OWNER
|
||||||
ln -s $(pwd) $GO_PKG_PATH
|
ln -sf $(pwd) $GO_PKG_PATH
|
||||||
|
|
||||||
# When invoked in container builder, this script runs under /workspace which is
|
# When invoked in container builder, this script runs under /workspace which is
|
||||||
# not under $GOPATH, so we need to `cd` to repo under GOPATH for it to build
|
# not under $GOPATH, so we need to `cd` to repo under GOPATH for it to build
|
||||||
cd $GO_PKG_PATH
|
cd $GO_PKG_PATH
|
||||||
|
|
||||||
/goreleaser release --config=cmd/$CMD/build/.goreleaser.yml --debug --rm-dist
|
|
||||||
# --skip-validate
|
# NOTE: if snapshot is enabled, release is not published to GitHub and the build
|
||||||
# --snapshot --skip-publish
|
# is available under workspace/dist directory.
|
||||||
|
SNAPSHOT=""
|
||||||
|
|
||||||
|
# parse commandline args copied from the link below
|
||||||
|
# https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]
|
||||||
|
do
|
||||||
|
key="$1"
|
||||||
|
|
||||||
|
case $key in
|
||||||
|
--snapshot)
|
||||||
|
SNAPSHOT="--snapshot"
|
||||||
|
shift # past argument
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
/goreleaser release --config=build/goreleaser.yml --rm-dist --skip-validate ${SNAPSHOT}
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
# TODO(droot): add instructions for running in production.
|
# TODO(droot): add instructions for running in production.
|
||||||
steps:
|
steps:
|
||||||
- name: "ubuntu"
|
- name: "gcr.io/cloud-builders/git"
|
||||||
args: ["mkdir", "-p", "/workspace/_output"]
|
args: [fetch, --tags, --depth=100]
|
||||||
- name: "gcr.io/kustomize-199618/golang_with_goreleaser:1.10-stretch"
|
- name: "gcr.io/kustomize-199618/golang_with_goreleaser:1.10-stretch"
|
||||||
args: ["bash", "cmd/kustomize/build/build.sh"]
|
args: ["bash", "build/build.sh"]
|
||||||
secretEnv: ['GITHUB_TOKEN']
|
secretEnv: ['GITHUB_TOKEN']
|
||||||
secrets:
|
secrets:
|
||||||
- kmsKeyName: projects/kustomize-199618/locations/global/keyRings/github-tokens/cryptoKeys/gh-release-token
|
- kmsKeyName: projects/kustomize-199618/locations/global/keyRings/github-tokens/cryptoKeys/gh-release-token
|
||||||
|
|||||||
@@ -21,10 +21,8 @@
|
|||||||
# Release tar will be in $OUTPUT
|
# Release tar will be in $OUTPUT
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "ubuntu"
|
|
||||||
args: ["mkdir", "-p", "/workspace/_output"]
|
|
||||||
- name: "gcr.io/kustomize-199618/golang_with_goreleaser:1.10-stretch"
|
- name: "gcr.io/kustomize-199618/golang_with_goreleaser:1.10-stretch"
|
||||||
args: ["bash", "cmd/kustomize/build/build.sh"]
|
args: ["bash", "build/build.sh", "--snapshot"]
|
||||||
secretEnv: ['GITHUB_TOKEN']
|
secretEnv: ['GITHUB_TOKEN']
|
||||||
secrets:
|
secrets:
|
||||||
- kmsKeyName: projects/kustomize-199618/locations/global/keyRings/github-tokens/cryptoKeys/gh-release-token
|
- kmsKeyName: projects/kustomize-199618/locations/global/keyRings/github-tokens/cryptoKeys/gh-release-token
|
||||||
|
|||||||
33
build/goreleaser.yaml
Normal file
33
build/goreleaser.yaml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# This is an example goreleaser.yaml file with some sane defaults.
|
||||||
|
# Make sure to check the documentation at http://goreleaser.com
|
||||||
|
project_name: kustomize
|
||||||
|
builds:
|
||||||
|
- main: ./kustomize.go
|
||||||
|
binary: kustomize
|
||||||
|
ldflags: -s -X github.com/kubernetes-sigs/kustomize/version.kustomizeVersion={{.Version}} -X github.com/kubernetes-sigs/kustomize/version.gitCommit={{.Commit}} -X github.com/kubernetes-sigs/kustomize/version.buildDate={{.Date}}
|
||||||
|
goos:
|
||||||
|
- darwin
|
||||||
|
- linux
|
||||||
|
- windows
|
||||||
|
goarch:
|
||||||
|
- amd64
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
|
checksum:
|
||||||
|
name_template: 'checksums.txt'
|
||||||
|
archive:
|
||||||
|
format: binary
|
||||||
|
snapshot:
|
||||||
|
name_template: "master"
|
||||||
|
changelog:
|
||||||
|
sort: asc
|
||||||
|
filters:
|
||||||
|
exclude:
|
||||||
|
- '^docs:'
|
||||||
|
- '^test:'
|
||||||
|
- Merge pull request
|
||||||
|
- Merge branch
|
||||||
|
release:
|
||||||
|
github:
|
||||||
|
owner: kubernetes-sigs
|
||||||
|
name: kustomize
|
||||||
Reference in New Issue
Block a user