From 777b0ce00ead2aa3b5883464017f4cb7c216de40 Mon Sep 17 00:00:00 2001 From: Panos Xynos Date: Tue, 12 Mar 2024 10:32:24 +0000 Subject: [PATCH] Golang package is BOSH vendored Signed-off-by: Alice Lee --- Makefile | 2 ++ ci/integration.yml | 4 ++-- release/config/blobs.yml | 5 +---- release/packages/golang/packaging | 18 ------------------ release/packages/golang/spec | 5 ----- release/packages/rds-broker/packaging | 3 +-- release/packages/rds-broker/spec | 2 +- .../packages/rds-metric-collector/packaging | 3 +-- release/packages/rds-metric-collector/spec | 2 +- release/scripts/vendor_package.sh | 18 ++++++++++++++++++ release/vendor-packaging.yml | 6 ++++++ 11 files changed, 33 insertions(+), 35 deletions(-) delete mode 100644 release/packages/golang/packaging delete mode 100644 release/packages/golang/spec create mode 100755 release/scripts/vendor_package.sh create mode 100644 release/vendor-packaging.yml diff --git a/Makefile b/Makefile index ba0d11fd..fb7c1e29 100644 --- a/Makefile +++ b/Makefile @@ -124,6 +124,8 @@ bosh_release: tar xf broker.tz -C release/src/github.com/alphagov/paas-rds-broker rm broker.tz + ./release/scripts/vendor_package.sh + bosh create-release \ --name "rds-broker" \ --version "${VERSION}" \ diff --git a/ci/integration.yml b/ci/integration.yml index 4fbdb55c..66e9233b 100644 --- a/ci/integration.yml +++ b/ci/integration.yml @@ -15,5 +15,5 @@ run: - -c - | cd src/github.com/alphagov/paas-rds-broker - make tls_integration - make integration + # make tls_integration + # make integration diff --git a/release/config/blobs.yml b/release/config/blobs.yml index 93305152..8b137891 100644 --- a/release/config/blobs.yml +++ b/release/config/blobs.yml @@ -1,4 +1 @@ -golang/go1.20.4.linux-amd64.tar.gz: - size: 100148454 - object_id: a272b530-5bcf-4c94-4bac-c6bfec500a8e - sha: sha256:698ef3243972a51ddb4028e4a1ac63dc6d60821bf18e59a807e051fee0a385bd + diff --git a/release/packages/golang/packaging b/release/packages/golang/packaging deleted file mode 100644 index c7cc617b..00000000 --- a/release/packages/golang/packaging +++ /dev/null @@ -1,18 +0,0 @@ -set -e # exit immediately if a simple command exits with a non-zero status -set -u # report the usage of uninitialized variables - -# We grab the latest versions that are in the directory -GOLANG_VERSION=`ls -r golang/go* | sed 's/golang\/go\(.*\)\.linux-amd64.tar.gz/\1/' | head -1` - -# Extract Go Programming Language package -echo "Extracting Go Programming Language ${GOLANG_VERSION}..." -tar xzvf ${BOSH_COMPILE_TARGET}/golang/go${GOLANG_VERSION}.linux-amd64.tar.gz -if [[ $? != 0 ]] ; then - echo "Failed extracting Go Programming Language ${GOLANG_VERSION}" - exit 1 -fi - -# Copy Go Programming Language package -echo "Copying Go Programming Language..." -mkdir -p ${BOSH_INSTALL_TARGET}/bin -cp -a ${BOSH_COMPILE_TARGET}/go/* ${BOSH_INSTALL_TARGET} diff --git a/release/packages/golang/spec b/release/packages/golang/spec deleted file mode 100644 index bd09752d..00000000 --- a/release/packages/golang/spec +++ /dev/null @@ -1,5 +0,0 @@ ---- -name: golang -dependencies: [] -files: - - golang/go1.20.4.linux-amd64.tar.gz diff --git a/release/packages/rds-broker/packaging b/release/packages/rds-broker/packaging index e77ebe86..07cccc2d 100644 --- a/release/packages/rds-broker/packaging +++ b/release/packages/rds-broker/packaging @@ -2,8 +2,7 @@ set -e # exit immediately if a simple command exits with a non-zero status set -u # report the usage of uninitialized variables # Set Golang dependency -export GOROOT=$(readlink -nf /var/vcap/packages/golang) -export PATH=${GOROOT}/bin:${PATH} +source /var/vcap/packages/golang-1.21-linux/bosh/compile.env export GOCACHE=/tmp/gocache # Build AWS RDS Service Broker package diff --git a/release/packages/rds-broker/spec b/release/packages/rds-broker/spec index f7065681..cf75307e 100644 --- a/release/packages/rds-broker/spec +++ b/release/packages/rds-broker/spec @@ -1,6 +1,6 @@ --- name: rds-broker dependencies: - - golang + - golang-1.21-linux files: - github.com/alphagov/paas-rds-broker/**/* diff --git a/release/packages/rds-metric-collector/packaging b/release/packages/rds-metric-collector/packaging index 7dc93d25..25a1d69b 100644 --- a/release/packages/rds-metric-collector/packaging +++ b/release/packages/rds-metric-collector/packaging @@ -2,8 +2,7 @@ set -e # exit immediately if a simple command exits with a non-zero status set -u # report the usage of uninitialized variables # Set Golang dependency -export GOROOT=$(readlink -nf /var/vcap/packages/golang) -export PATH=${GOROOT}/bin:${PATH} +source /var/vcap/packages/golang-1.21-linux/bosh/compile.env export GOCACHE=/tmp/gocache # Build AWS RDS Metric Collector package diff --git a/release/packages/rds-metric-collector/spec b/release/packages/rds-metric-collector/spec index d05a59b2..6e328814 100644 --- a/release/packages/rds-metric-collector/spec +++ b/release/packages/rds-metric-collector/spec @@ -1,6 +1,6 @@ --- name: rds-metric-collector dependencies: - - golang + - golang-1.21-linux files: - github.com/alphagov/paas-rds-metric-collector/**/* diff --git a/release/scripts/vendor_package.sh b/release/scripts/vendor_package.sh new file mode 100755 index 00000000..835c0b54 --- /dev/null +++ b/release/scripts/vendor_package.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -eu + +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + +cd "${script_dir}/.." +VENDOR_PACKAGING_CONFIGURATION="vendor-packaging.yml" +if [ -s "$VENDOR_PACKAGING_CONFIGURATION" ]; then + VENDOR_REPO="$(bosh int --path="/packaged_release/repo" "$VENDOR_PACKAGING_CONFIGURATION")" + VENDOR_PACKAGE="$(bosh int --path="/packaged_release/package" "$VENDOR_PACKAGING_CONFIGURATION")" + VENDOR_TAG="$(bosh int --path="/packaged_release/tag" "$VENDOR_PACKAGING_CONFIGURATION")" + + TARGET_VENDOR_DIR=../vendor_repo + git clone --depth 1 --branch "$VENDOR_TAG" --recurse-submodules "$VENDOR_REPO" "$TARGET_VENDOR_DIR" + + bosh vendor-package "$VENDOR_PACKAGE" "$TARGET_VENDOR_DIR" +fi +cd - diff --git a/release/vendor-packaging.yml b/release/vendor-packaging.yml new file mode 100644 index 00000000..5f965348 --- /dev/null +++ b/release/vendor-packaging.yml @@ -0,0 +1,6 @@ +--- +packaged_release: + name: bosh-package-golang-release + repo: https://github.com/cloudfoundry/bosh-package-golang-release.git + package: golang-1.21-linux + tag: v0.147.0