From 22dd78fb429fe128c54a066dc087d7b06aaae01f Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 3 Aug 2022 08:39:39 -0700 Subject: [PATCH 1/3] Isolate spec runs to acceptance repository --- .github/workflows/spectesting.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/spectesting.yml b/.github/workflows/spectesting.yml index e0a532eab..c20d84de4 100644 --- a/.github/workflows/spectesting.yml +++ b/.github/workflows/spectesting.yml @@ -9,6 +9,7 @@ on: jobs: setup-packet: + if: github.repository == 'hashicorp/vagrant-acceptance' runs-on: self-hosted name: Build Packet Instance steps: @@ -21,6 +22,7 @@ jobs: VAGRANT_CI_LOADER_BUCKET: ${{ secrets.VAGRANT_CI_LOADER_BUCKET }} setup-hosts: + if: github.repository == 'hashicorp/vagrant-acceptance' runs-on: self-hosted name: Vagrant-Spec Start Hosts needs: setup-packet @@ -34,7 +36,7 @@ jobs: uses: actions/checkout@v1 with: submodules: 'recursive' - - name: Create packet host for tests (provider ${{ matrix.providers }}) + - name: Create hosts for tests (provider ${{ matrix.providers }}) run: ./.ci/spec/create-hosts.sh working-directory: ${{github.workspace}} env: @@ -45,6 +47,7 @@ jobs: VAGRANT_CI_LOADER_BUCKET: ${{ secrets.VAGRANT_CI_LOADER_BUCKET }} spec-tests: + if: github.repository == 'hashicorp/vagrant-acceptance' runs-on: self-hosted name: Vagrant-Spec Tests needs: setup-hosts From db315784388f899e5aff93ffdeee1e42f4c6df54 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 3 Aug 2022 10:14:38 -0700 Subject: [PATCH 2/3] Add 32 bit build target for linux --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 87db8a61c..20b73b78a 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -# A lot of this Makefile right now is temporary since we have a private -# repo so that we can more sanely create ASSETFS_PATH?=internal/server/gen/bindata_ui.go GIT_COMMIT=$$(git rev-parse --short HEAD) @@ -20,8 +18,7 @@ debug: # debug creates an executable with optimizations off, suitable for debugg .PHONY: bin/windows bin/windows: # create windows binaries - GOOS=linux GOARCH=amd64 go build -o ./internal/assets/ceb/ceb ./cmd/vagrant-entrypoint - cd internal/assets && go-bindata -pkg assets -o prod.go -tags assetsembedded ./ceb + @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; }# GOOS=windows GOARCH=amd64 CGO_ENABLED=$(CGO_ENABLED) go build -ldflags $(GOLDFLAGS) -tags assetsembedded -o ./vagrant.exe ./cmd/vagrant .PHONY: bin/linux @@ -29,6 +26,11 @@ bin/linux: # create Linux binaries @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; } GOOS=linux GOARCH=amd64 $(MAKE) bin +.PHONY: bin/linux-386 +bin/linux-386: # create Linux binaries + @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; } + GOOS=linux GOARCH=386 $(MAKE) bin + .PHONY: bin/darwin bin/darwin: # create Darwin binaries @test -s "thirdparty/proto/api-common-protos/.git" || { echo "git submodules not initialized, run 'git submodule update --init --recursive' and try again"; exit 1; } From d2e95ad3b57826b7245a7147db9633b63a90ed89 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 3 Aug 2022 10:15:01 -0700 Subject: [PATCH 3/3] Build and store multiple types for binary --- .ci/build.sh | 53 +++++++++++++++++++++++++++++++++++++++++--------- .ci/release.sh | 51 +++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 86 insertions(+), 18 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index 74c9e7c73..f5f038957 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -23,18 +23,53 @@ wrap aws s3 cp "${gem}" "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-main.gem # Install submodules wrap git submodule update --init --recursive \ "Failed to install git submodules" -# Build our binary -wrap make \ - "Failed to build the Vagrant go binary" + +# Build our binaries + +# Build linux amd64 binary +wrap make bin/linux \ + "Failed to build the Vagrant go linux amd64 binary" # Rename our binary -wrap mv vagrant vagrant-go \ - "Failed to rename vagrant binary" +wrap mv vagrant vagrant-go_linux_amd64 \ + "Failed to rename vagrant linux amd64 binary" # Zip the binary -wrap zip vagrant-go vagrant-go \ - "Failed to compress go binary" +wrap zip vagrant-go_linux_amd64 vagrant-go_linux_amd64 \ + "Failed to compress go linux amd64 binary" # Store the binary asset -wrap aws s3 cp vagrant-go.zip "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-go-main.zip" \ - "Failed to store Vagrant Go main build" +wrap aws s3 cp vagrant-go_linux_amd64.zip "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-go_main_linux_amd64.zip" \ + "Failed to store Vagrant Go linux amd64 main build" + +# Build linux 386 binary +wrap make bin/linux-386 \ + "Failed to build the Vagrant go linux 386 binary" + +# Rename our binary +wrap mv vagrant vagrant-go_linux_386 \ + "Failed to rename vagrant linux 386 binary" + +# Zip the binary +wrap zip vagrant-go_linux_386 vagrant-go_linux_386 \ + "Failed to compress go linux 386 binary" + +# Store the binary asset +wrap aws s3 cp vagrant-go_linux_386.zip "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-go_main_linux_386.zip" \ + "Failed to store Vagrant Go linux 386 main build" + +# Build darwin binary +wrap make bin/darwin \ + "Failed to build the Vagrant go darwin amd64 binary" + +# Rename our binary +wrap mv vagrant vagrant-go_darwin_amd64 \ + "Failed to rename vagrant darwin amd64 binary" + +# Zip the binary +wrap zip vagrant-go_darwin_amd64 vagrant-go_darwin_amd64 \ + "Failed to compress go darwin amd64 binary" + +# Store the binary asset +wrap aws s3 cp vagrant-go_darwin_amd64.zip "${ASSETS_PRIVATE_BUCKET}/${repository}/vagrant-go_main_darwin_amd64.zip" \ + "Failed to store Vagrant Go darwin amd64 main build" diff --git a/.ci/release.sh b/.ci/release.sh index 93c099d50..94de1ee46 100755 --- a/.ci/release.sh +++ b/.ci/release.sh @@ -35,22 +35,55 @@ gem=$(printf "%s" "${g}") vagrant_version="$(gem specification "${gem}" version)" vagrant_version="${vagrant_version##*version: }" -# Build the go binary -wrap make \ - "Failed to build the Vagrant go binary" +# Install submodules +wrap git submodule update --init --recursive \ + "Failed to install git submodules" -wrap mv vagrant vagrant-go \ - "Failed to rename Vagrant go binary" -wrap zip vagrant-go vagrant-go \ - "Failed to compress go binary" +# Build our binaries + +# Build linux amd64 binary +wrap make bin/linux \ + "Failed to build the Vagrant go linux amd64 binary" + +# Rename our binary +wrap mv vagrant vagrant-go_linux_amd64 \ + "Failed to rename vagrant linux amd64 binary" + +# Zip the binary +wrap zip "vagrant-go_${vagrant_version}_linux_amd64" vagrant-go_linux_amd64 \ + "Failed to compress go linux amd64 binary" + +# Build linux 386 binary +wrap make bin/linux-386 \ + "Failed to build the Vagrant go linux 386 binary" + +# Rename our binary +wrap mv vagrant vagrant-go_linux_386 \ + "Failed to rename vagrant linux 386 binary" + +# Zip the binary +wrap zip "vagrant-go_${vagrant_version}_linux_386" vagrant-go_linux_386 \ + "Failed to compress go linux 386 binary" + +# Build darwin binary +wrap make bin/darwin \ + "Failed to build the Vagrant go darwin amd64 binary" + +# Rename our binary +wrap mv vagrant vagrant-go_darwin_amd64 \ + "Failed to rename vagrant darwin amd64 binary" + +# Zip the binary +wrap zip "vagrant-go_${vagrant_version}_darwin_amd64" vagrant-go_darwin_amd64 \ + "Failed to compress go darwin amd64 binary" wrap mkdir release-assets \ "Failed to create release assets directory" wrap mv vagrant*.gem release-assets \ "Failed to move Vagrant RubyGem asset to release asset directory" -wrap mv vagrant-go.zip release-assets \ - "Failed to move Vagrant go asset to release asset directory" +wrap mv vagrant-go*.zip release-assets \ + "Failed to move Vagrant go assets to release asset directory" # We want to release into the builders repository so # update the repository variable with the desired destination