goreleaser: update example image tags to match version being released

Signed-off-by: Steve Kriss <steve@heptio.com>
pull/1045/head
Steve Kriss 2018-11-08 16:08:56 -07:00
parent cbef9da721
commit eace0255de
3 changed files with 41 additions and 1 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@
_obj
_test
_output
config
# Architecture specific extensions/prefixes
*.[568vq]

View File

@ -13,6 +13,9 @@
# limitations under the License.
dist: _output
before:
hooks:
- ./hack/set-example-tags.sh
builds:
- main: ./cmd/ark/main.go
env:
@ -41,7 +44,7 @@ archive:
name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
files:
- LICENSE
- examples/**/*
- config/**/*
checksum:
name_template: 'CHECKSUM'
snapshot:

36
hack/set-example-tags.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
# Copyright 2018 the Heptio Ark contributors.
#
# 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 nounset
set -o errexit
set -o pipefail
# this script copies all of the files under examples/ into a new directory,
# config/ (which is gitignored so it doesn't result in the git
# state being dirty, which would prevent goreleaser from running), and then
# updates all of the image tags in those files to use $GIT_SHA (which will
# be the release/tag name).
rm -rf config/ && cp -r examples/ config/
# the "-i'.bak'" flag to sed is necessary, with no space between the flag
# and the value, for this to be compatible across BSD/OSX sed and GNU sed.
# remove the ".bak" files afterwards (they're copies of the originals).
find config/ -type f -name "*.yaml" | xargs sed -i'.bak' "s|gcr.io/heptio-images/ark:latest|gcr.io/heptio-images/ark:$GIT_SHA|g"
find config/ -type f -name "*.bak" | xargs rm
find config/ -type f -name "*.yaml" | xargs sed -i'.bak' "s|gcr.io/heptio-images/fsfreeze-pause:latest|gcr.io/heptio-images/fsfreeze-pause:$GIT_SHA|g"
find config/ -type f -name "*.bak" | xargs rm