@@ -2,19 +2,6 @@ GOSRC = $(shell find . -name "*.go" ! -name "*test.go" ! -name "*fake*" ! -path
22STEMCELL_VERSION = $(shell echo "$${STEMBUILD_VERSION}")
33LD_FLAGS = "-w -s -X github.com/cloudfoundry/stembuild/version.Version=${STEMCELL_VERSION}"
44
5- # These are the sources for StemcellAutomation.zip
6- STEMCELL_AUTOMATION_PS1 := $(shell ls stemcell-automation/* ps1 | grep -iv Test)
7- BOSH_AGENT_REPO ?= ${HOME}/go/src/github.com/cloudfoundry/bosh-agent
8- LGPO_URL = 'https://download.microsoft.com/download/8/5/C/85C25433-A1B0-4FFA-9429-7E023E7DA8D8/LGPO.zip'
9- BOSH_GCS_URL = 'https://s3.amazonaws.com/bosh-gcscli/bosh-gcscli-0.0.6-windows-amd64.exe'
10- BOSH_BLOBSTORE_DAV_URL = http://bosh-davcli-artifacts.s3.amazonaws.com
11- BOSH_BLOBSTORE_S3_URL = http://bosh-s3cli-artifacts.s3.amazonaws.com
12- BOSH_WINDOWS_DEPENDENCIES_URL = http://bosh-windows-dependencies.s3.amazonaws.com
13- # Ignore things under cis-merge* directory because the paths contain spaces and make doesn't like
14- # that
15- PSMODULES_SOURCES = $(shell find ./modules | grep -v .git | grep -vi "test" | grep -v cis-merge)
16- BOSH_AGENT_SOURCES = $(shell find $(BOSH_AGENT_REPO ) | egrep -v ".git|test.go|fake|.md")
17-
185ifeq ($(OS ) ,Windows_NT)
196 COMMAND = out/stembuild.exe
207 CP = cp
@@ -54,12 +41,10 @@ integration-badger : generate-fake-stemcell-automation
5441generate-fake-stemcell-automation :
5542 $(CP ) integration/construct/assets/StemcellAutomation.zip assets/
5643
57- generate : assets/StemcellAutomation.zip
58-
59- out/stembuild : generate $(GOSRC )
44+ out/stembuild : assets/StemcellAutomation.zip $(GOSRC )
6045 CGO_ENABLED=0 go build -o $(COMMAND ) -ldflags $(LD_FLAGS ) .
6146
62- out/stembuild.exe : generate $(GOSRC )
47+ out/stembuild.exe : assets/StemcellAutomation.zip $(GOSRC )
6348 GOOS=windows CGO_ENABLED=0 go build -o out/stembuild.exe -ldflags $(LD_FLAGS ) .
6449
6550test : units
@@ -73,104 +58,9 @@ units : format generate-fake-stemcell-automation
7358contract :
7459 go run github.com/onsi/ginkgo/v2/ginkgo -r --randomize-all --randomize-suites --keep-going --flake-attempts 2 iaas_cli
7560
76- .PHONY : all build build-integration clean format generate generate -fake-stemcell-automation
61+ .PHONY : all build build-integration clean format generate-fake-stemcell-automation
7762.PHONY : test units units-full integration integration-tests-full
7863
79- # ===============================================================================
80- # The following to create the StemcellAutomation.zip that's packaged in stembuild
81- # ===============================================================================
82-
83- assets/local/bosh-agent.exe : $(BOSH_AGENT_SOURCES )
84- cd $(BOSH_AGENT_REPO ) && \
85- GOOS=windows GOARCH=amd64 bin/build && \
86- cd -
87- mv $(BOSH_AGENT_REPO ) /out/bosh-agent assets/local/bosh-agent.exe
88-
89- assets/local/bosh-blobstore-dav.exe :
90- @echo " ### Creating assets/local/bosh-blobstore-dav.exe"
91- $(eval BOSH_BLOBSTORE_DAV_FILE=$(shell curl -s $(BOSH_BLOBSTORE_DAV_URL ) | xq --xpath '//Key' | sort --version-sort | tail -1) )
92- curl -o assets/local/bosh-blobstore-dav.exe -L $(BOSH_BLOBSTORE_DAV_URL ) /$(BOSH_BLOBSTORE_DAV_FILE )
93-
94- assets/local/bosh-blobstore-gcs.exe :
95- @echo " ### Creating assets/local/bosh-blobstore-gcs.exe"
96- curl -o assets/local/bosh-blobstore-gcs.exe -L $(BOSH_GCS_URL )
97-
98- assets/local/bosh-blobstore-s3.exe :
99- @echo " ### Creating assets/local/bosh-blobstore-s3.exe"
100- $(eval BOSH_BLOBSTORE_S3_FILE=$(shell curl -s $(BOSH_BLOBSTORE_S3_URL ) | xq --xpath '//Key' | sort --version-sort | tail -1) )
101- curl -o assets/local/bosh-blobstore-s3.exe -L $(BOSH_BLOBSTORE_S3_URL ) /$(BOSH_BLOBSTORE_S3_FILE )
102-
103- assets/local/bosh-psmodules.zip : $(PSMODULES_SOURCES )
104- @echo " ### Creating/Updating assets/local/bosh-psmodules.zip"
105- cd modules && zip -r ../bosh-psmodules.zip . && cd ..
106- mv bosh-psmodules.zip assets/local/bosh-psmodules.zip
107-
108- assets/local/job-service-wrapper.exe : $(BOSH_AGENT_REPO ) /integration/windows/fixtures/job-service-wrapper.exe
109- @echo " ### Creating/Updating assets/local/job-service-wrapper.exe"
110- $(CP ) $(BOSH_AGENT_REPO ) /integration/windows/fixtures/job-service-wrapper.exe assets/local
111-
112- assets/local/pipe.exe : $(BOSH_AGENT_SOURCES )
113- cd $(BOSH_AGENT_REPO ) && \
114- GOOS=windows GOARCH=amd64 bin/build && \
115- cd -
116- mv $(BOSH_AGENT_REPO ) /out/bosh-agent-pipe assets/local/pipe.exe
117-
118- assets/local/service_wrapper.exe : $(BOSH_AGENT_REPO ) /integration/windows/fixtures/service_wrapper.exe
119- @echo " ### Creating/Updating assets/local/service_wrapper.exe"
120- $(CP ) $(BOSH_AGENT_REPO ) /integration/windows/fixtures/service_wrapper.exe assets/local
121-
122- assets/local/service_wrapper.xml : $(BOSH_AGENT_REPO ) /integration/windows/fixtures/service_wrapper.xml
123- @echo " ### Creating/Updating assets/local/service_wrapper.xml"
124- $(CP ) $(BOSH_AGENT_REPO ) /integration/windows/fixtures/service_wrapper.xml assets/local
125-
126- assets/local/tar.exe :
127- @echo " ### Creating assets/local/tar.exe"
128- $(eval BOSH_WINDOWS_DEPENDENCIES_FILE=$(shell curl -s $(BOSH_WINDOWS_DEPENDENCIES_URL ) | xq --xpath '//Key[contains(text() , "tar") ]' | sort --version-sort | tail -1))
129- curl -o assets/local/tar.exe -L $(BOSH_WINDOWS_DEPENDENCIES_URL ) /$(BOSH_WINDOWS_DEPENDENCIES_FILE )
130-
131- assets/local/agent.zip : assets/local/bosh-agent.exe assets/local/pipe.exe assets/local/service_wrapper.xml assets/local/service_wrapper.exe assets/local/bosh-blobstore-dav.exe assets/local/bosh-blobstore-gcs.exe assets/local/bosh-blobstore-s3.exe assets/local/job-service-wrapper.exe assets/local/tar.exe
132- @echo " ### Creating/Updating assets/local/agent.zip"
133- mkdir -p assets/temp/deps
134- $(CP ) assets/local/service_wrapper.exe \
135- assets/local/service_wrapper.xml \
136- assets/local/bosh-agent.exe \
137- assets/temp
138- $(CP ) assets/local/bosh-blobstore-dav.exe \
139- assets/local/bosh-blobstore-gcs.exe \
140- assets/local/bosh-blobstore-s3.exe \
141- assets/local/job-service-wrapper.exe \
142- assets/local/pipe.exe \
143- assets/local/tar.exe \
144- assets/temp/deps
145- cd assets/temp && zip -r ../local/agent.zip * && cd -
146- rm -rf assets/temp
147-
148- assets/local/LGPO.zip :
149- @echo " ### Creating assets/local/LGPO.zip"
150- curl -o assets/local/LGPO.zip -L $(LGPO_URL )
151-
152- assets/local/OpenSSH-Win64.zip : $(BOSH_AGENT_REPO ) /integration/windows/fixtures/OpenSSH-Win64.zip
153- @echo " ### Creating/Updating assets/local/OpenSSH-Win64.zip"
154- $(CP ) $(BOSH_AGENT_REPO ) /integration/windows/fixtures/OpenSSH-Win64.zip assets/local
155-
156- assets/local/deps.json : assets/local/agent.zip assets/local/bosh-psmodules.zip assets/local/LGPO.zip assets/local/OpenSSH-Win64.zip
157- @echo " ### Creating/Updating assets/local/deps.json"
158- @# Note: The order of the following matters, change the script before changing these
159- stemcell-automation/generate-dep-json.bash \
160- assets/local/OpenSSH-Win64.zip \
161- assets/local/bosh-psmodules.zip \
162- assets/local/agent.zip \
163- assets/local/LGPO.zip \
164- > assets/local/deps.json
165-
166- assets/StemcellAutomation.zip : $(STEMCELL_AUTOMATION_PS1 ) assets/local/OpenSSH-Win64.zip assets/local/bosh-psmodules.zip assets/local/deps.json assets/local/agent.zip
167- @echo " ### Creating/Updating assets/StemcellAutomation.zip"
168- mkdir -p assets/temp
169- cp -a $(STEMCELL_AUTOMATION_PS1 ) \
170- assets/local/OpenSSH-Win64.zip \
171- assets/local/bosh-psmodules.zip \
172- assets/local/deps.json \
173- assets/local/agent.zip \
174- assets/temp
175- cd assets/temp && zip ../StemcellAutomation.zip * && cd -
176- rm -rf assets/temp
64+ assets/StemcellAutomation.zip :
65+ @echo " Unable to locate assets/StemcellAutomation.zip. This file is bundled into the final stembuild executable and must be present. Please see README.md on how to construct this file."
66+ exit 1
0 commit comments