Skip to content

Commit 60447ea

Browse files
committed
Support latest version of pack
Additionally, added a check that warns if the installed version of pack is different than what's expected (typically latest). We were seeing failures in CI that we weren't seeing locally. It came down to CI running a newer (latest) version of pack in which the platform API was changed so therefore the output changed slightly. Signed-off-by: Javier Romero <[email protected]>
1 parent 72a4cee commit 60447ea

File tree

4 files changed

+156
-136
lines changed

4 files changed

+156
-136
lines changed

Makefile

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Retrieve latest pack version
22
PACK_VERSION?=
33
GITHUB_TOKEN?=
4-
PACK_BIN?=$(shell which pack)
54
SERVE_PORT=1313
65
BASE_URL?=
76

@@ -71,22 +70,35 @@ endif
7170

7271
.PHONY: upgrade-pack
7372
upgrade-pack: pack-version
74-
@echo "> Upgrading to pack version $(PACK_VERSION)"
73+
@echo "> Upgrading pack library version $(PACK_VERSION)"
7574
cd tools; go get github.com/buildpacks/pack@v$(PACK_VERSION)
7675

7776
.PHONY: install-pack-cli
77+
install-pack-cli: export PACK_BIN:=$(shell which pack)
7878
install-pack-cli: upgrade-pack
7979
@echo "> Installing pack bin..."
80-
ifeq ($(PACK_BIN),)
81-
cd tools; go get github.com/buildpacks/pack/cmd/pack
82-
else
83-
@echo "pack already installed at $(PACK_BIN)"
84-
endif
80+
@if [ -z "$(PACK_BIN)" ]; then \
81+
cd tools; go install github.com/buildpacks/pack/cmd/pack; \
82+
else \
83+
echo "pack already installed at $(PACK_BIN)"; \
84+
fi
85+
@echo "pack version: $(shell pack --version)"
86+
87+
.PHONY: check-pack-cli-version
88+
check-pack-cli-version: export INSTALLED_VERSION:=$(shell pack --version | cut -d '+' -f 1)
89+
check-pack-cli-version:
90+
@echo "> Installed pack version: $(INSTALLED_VERSION)"
91+
@if [ "$(INSTALLED_VERSION)" != "$(PACK_VERSION)" ]; then \
92+
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
93+
echo "WARNING: Expected pack version: $(PACK_VERSION)"; \
94+
echo "You may need to upgrade your version of pack! "; \
95+
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; \
96+
fi
8597

8698
.PHONY: install-ugo
8799
install-ugo:
88100
@echo "> Installing ugo..."
89-
cd tools; go get github.com/jromero/ugo/cmd/[email protected]
101+
cd tools; go install github.com/jromero/ugo/cmd/[email protected]
90102

91103
.PHONY: pack-docs-update
92104
pack-docs-update: upgrade-pack
@@ -120,7 +132,7 @@ build: $(HUGO_BIN) pack-version pack-docs-update
120132
$(HUGO_BIN)
121133

122134
.PHONY: test
123-
test: install-pack-cli install-ugo
135+
test: install-pack-cli check-pack-cli-version install-ugo
124136
@echo "> Testing..."
125137
ugo run -r -p ./content/docs/
126138

content/docs/buildpack-author-guide/create-buildpack/detection.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ You should see the following output:
3838

3939
<!-- test:assert=contains -->
4040
```
41-
===> DETECTING
42-
[detector] examples/ruby 0.0.1
4341
===> ANALYZING
4442
[analyzer] Previous image with name "test-ruby-app" not found
43+
===> DETECTING
44+
[detector] examples/ruby 0.0.1
4545
===> RESTORING
4646
===> BUILDING
4747
[builder] ---> Ruby Buildpack

tools/go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ module github.com/buildpacks/docs/tools
33
go 1.14
44

55
require (
6-
github.com/buildpacks/pack v0.22.0
6+
github.com/buildpacks/pack v0.23.0
77
github.com/gohugoio/hugo v0.82.0
88
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
9-
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2 // indirect
109
github.com/sabhiram/go-gitignore v0.0.0-20201211210132-54b8a0bf510f // indirect
1110
github.com/spf13/cobra v1.2.1
12-
k8s.io/code-generator v0.19.7 // indirect
13-
k8s.io/gengo v0.0.0-20201113003025-83324d819ded // indirect
1411
)

0 commit comments

Comments
 (0)