diff --git a/ci/tasks/build.sh b/ci/tasks/build.sh index c01d208f..3faa6e08 100755 --- a/ci/tasks/build.sh +++ b/ci/tasks/build.sh @@ -7,22 +7,23 @@ ssh-keyscan github.com >>~/.ssh/known_hosts SOURCE_DIR=$PWD/source +go version go install github.com/xchapter7x/versioning@latest -export GOPATH="$HOME/go" +export GOPATH="$(go env GOPATH)" export PATH="$GOPATH/bin:$PATH" -pushd ${SOURCE_DIR} > /dev/null - if [ -d ".git" ]; then +pushd ${SOURCE_DIR} >/dev/null + if [ -d ".git" ]; then if ${DEV}; then ts=$(date +"%Y%m%M%S%N") DRAFT_VERSION="dev-${ts}" COMMIT="dev" VERSION="dev" else - DRAFT_VERSION=`versioning bump_patch`-`git rev-parse HEAD` - COMMIT=`git rev-parse HEAD` - VERSION=`versioning bump_patch` + DRAFT_VERSION=$(versioning bump_patch)-$(git rev-parse HEAD) + COMMIT=$(git rev-parse HEAD) + VERSION=$(versioning bump_patch) fi else DRAFT_VERSION="v0.0.0" @@ -38,7 +39,7 @@ WORKING_DIR=$GOPATH/src/github.com/vmwarepivotallabs/cf-mgmt mkdir -p ${WORKING_DIR} cp -R ${SOURCE_DIR}/* ${WORKING_DIR}/. -pushd ${WORKING_DIR} > /dev/null +pushd ${WORKING_DIR} >/dev/null CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ${OUTPUT_DIR}/cf-mgmt-linux -ldflags "-X github.com/vmwarepivotallabs/cf-mgmt/configcommands.VERSION=${VERSION} -X github.com/vmwarepivotallabs/cf-mgmt/configcommands.COMMIT=${COMMIT}" cmd/cf-mgmt/main.go CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ${OUTPUT_DIR}/cf-mgmt-linux-arm64 -ldflags "-X github.com/vmwarepivotallabs/cf-mgmt/configcommands.VERSION=${VERSION} -X github.com/vmwarepivotallabs/cf-mgmt/configcommands.COMMIT=${COMMIT}" cmd/cf-mgmt/main.go GOOS=darwin GOARCH=amd64 go build -o ${OUTPUT_DIR}/cf-mgmt-osx -ldflags "-X github.com/vmwarepivotallabs/cf-mgmt/configcommands.VERSION=${VERSION} -X github.com/vmwarepivotallabs/cf-mgmt/configcommands.COMMIT=${COMMIT}" cmd/cf-mgmt/main.go @@ -55,9 +56,9 @@ pushd ${WORKING_DIR} > /dev/null popd if ${DEV}; then - echo ${DRAFT_VERSION} > "${OUTPUT_DIR}/name" - echo ${DRAFT_VERSION} > "${OUTPUT_DIR}/tag" + echo ${DRAFT_VERSION} >"${OUTPUT_DIR}/name" + echo ${DRAFT_VERSION} >"${OUTPUT_DIR}/tag" else - echo ${VERSION} > "${OUTPUT_DIR}/name" - echo ${VERSION} > "${OUTPUT_DIR}/tag" + echo ${VERSION} >"${OUTPUT_DIR}/name" + echo ${VERSION} >"${OUTPUT_DIR}/tag" fi diff --git a/ci/tasks/build.yml b/ci/tasks/build.yml index 498d63a0..e3c0292a 100644 --- a/ci/tasks/build.yml +++ b/ci/tasks/build.yml @@ -2,7 +2,7 @@ platform: linux image_resource: source: repository: harbor-repo.vmware.com/cryogenics/essentials - tag: 0.1.112 + tag: latest type: registry-image run: path: source/ci/tasks/build.sh diff --git a/ci/tasks/runIntegrationTests.sh b/ci/tasks/runIntegrationTests.sh index 54fbecbf..dfcaf380 100755 --- a/ci/tasks/runIntegrationTests.sh +++ b/ci/tasks/runIntegrationTests.sh @@ -18,11 +18,11 @@ eval "$(bbl print-env --metadata-file cf-deployment-env/metadata)" go version go install code.cloudfoundry.org/uaa-cli@latest -export PATH=$PATH:$(go env GOPATH)/bin +export GOPATH="$(go env GOPATH)" +export PATH="$GOPATH/bin:$PATH" -if [ -z "$SYSTEM_DOMAIN" ] -then - SYSTEM_DOMAIN=$( get_system_domain ) +if [ -z "$SYSTEM_DOMAIN" ]; then + SYSTEM_DOMAIN=$(get_system_domain) fi uaa-cli target "https://uaa.${SYSTEM_DOMAIN}" -k @@ -39,5 +39,5 @@ pushd source > /dev/null CF_ADMIN_PASSWORD=$(get_from_credhub cf_admin_password) \ ADMIN_CLIENT_SECRET=$(get_from_credhub uaa_admin_client_secret) \ RUN_INTEGRATION_TESTS=true \ - go run github.com/onsi/ginkgo/v2/ginkgo ./integration/... --show-node-events -vv --poll-progress-after + go run github.com/onsi/ginkgo/v2/ginkgo ./integration/... --show-node-events -vv --poll-progress-after popd > /dev/null diff --git a/ci/tasks/runIntegrationTestsAgainstTAS.sh b/ci/tasks/runIntegrationTestsAgainstTAS.sh index 93ba31d1..8b74797c 100755 --- a/ci/tasks/runIntegrationTestsAgainstTAS.sh +++ b/ci/tasks/runIntegrationTestsAgainstTAS.sh @@ -14,9 +14,9 @@ ADMIN_CLIENT_SECRET="$( \ --skip-ssl-validation \ --env env/pcf.yml \ credentials \ - --product-name cf \ - --credential-reference .uaa.admin_client_credentials \ - --credential-field password \ + --product-name cf \ + --credential-reference .uaa.admin_client_credentials \ + --credential-field password \ )" uaac target "uaa.$SYSTEM_DOMAIN" --skip-ssl-validation @@ -34,14 +34,14 @@ CF_ADMIN_PASSWORD="$( \ --skip-ssl-validation \ --env env/pcf.yml \ credentials \ - --product-name cf \ - --credential-reference .uaa.admin_credentials \ - --credential-field password \ + --product-name cf \ + --credential-reference .uaa.admin_credentials \ + --credential-field password \ )" -pushd source > /dev/null +pushd source >/dev/null export ADMIN_CLIENT_SECRET CF_ADMIN_PASSWORD SYSTEM_DOMAIN RUN_INTEGRATION_TESTS=true \ go run github.com/onsi/ginkgo/v2/ginkgo ./integration/... --show-node-events -vv --poll-progress-after -popd > /dev/null +popd >/dev/null diff --git a/ci/tasks/runIntegrationTestsAgainstTAS.yml b/ci/tasks/runIntegrationTestsAgainstTAS.yml index 6677ec73..71ecffa7 100644 --- a/ci/tasks/runIntegrationTestsAgainstTAS.yml +++ b/ci/tasks/runIntegrationTestsAgainstTAS.yml @@ -3,7 +3,7 @@ image_resource: type: registry-image source: repository: harbor-repo.vmware.com/cryogenics/essentials - tag: 0.1.112 + tag: latest inputs: - name: source - name: env diff --git a/ci/tasks/runTests.sh b/ci/tasks/runTests.sh index 20e2a88c..1b891f32 100755 --- a/ci/tasks/runTests.sh +++ b/ci/tasks/runTests.sh @@ -2,7 +2,7 @@ set -eu -o pipefail -pushd "source" > /dev/null +pushd "source" >/dev/null go version echo "Running go vet" diff --git a/ci/tasks/runTests.yml b/ci/tasks/runTests.yml index 52b24444..70044c7f 100644 --- a/ci/tasks/runTests.yml +++ b/ci/tasks/runTests.yml @@ -2,7 +2,7 @@ platform: linux image_resource: source: repository: harbor-repo.vmware.com/cryogenics/essentials - tag: 0.1.112 + tag: latest type: registry-image run: path: source/ci/tasks/runTests.sh