Skip to content

Commit

Permalink
goreleaser: update example image tags to match version being released
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Kriss <steve@heptio.com>
  • Loading branch information
skriss committed Nov 14, 2018
1 parent cbef9da commit eace025
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
_obj
_test
_output
config

# Architecture specific extensions/prefixes
*.[568vq]
Expand Down
5 changes: 4 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# limitations under the License.

dist: _output
before:
hooks:
- ./hack/set-example-tags.sh
builds:
- main: ./cmd/ark/main.go
env:
Expand Down Expand Up @@ -41,7 +44,7 @@ archive:
name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
files:
- LICENSE
- examples/**/*
- config/**/*
checksum:
name_template: 'CHECKSUM'
snapshot:
Expand Down
36 changes: 36 additions & 0 deletions hack/set-example-tags.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit eace025

Please sign in to comment.