From 9d2c2a6460a7c486082758c33586815497d15345 Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Mon, 1 Apr 2024 08:59:06 -0400 Subject: [PATCH] Testing pipeline builder fix Signed-off-by: Daniel Mikusa --- .github/workflows/pb-create-package.yml | 25 ++++++++++++-------- .github/workflows/pb-tests.yml | 29 ++++++++++++++---------- .github/workflows/pb-update-pipeline.yml | 5 +++- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/.github/workflows/pb-create-package.yml b/.github/workflows/pb-create-package.yml index d358b81..bcfc6c9 100644 --- a/.github/workflows/pb-create-package.yml +++ b/.github/workflows/pb-create-package.yml @@ -106,7 +106,7 @@ jobs: run: | #!/usr/bin/env bash - set -euo pipefail + set -xeuo pipefail # With Go 1.20, we need to set this so that we produce statically compiled binaries # @@ -117,21 +117,23 @@ jobs: if [[ "${INCLUDE_DEPENDENCIES}" == "true" ]]; then create-package \ - --source ${SOURCE_PATH:-.} \ + --source "${SOURCE_PATH:-.}" \ --cache-location "${HOME}"/carton-cache \ --destination "${HOME}"/buildpack \ --include-dependencies \ --version "${VERSION}" else create-package \ - --source ${SOURCE_PATH:-.} \ + --source "${SOURCE_PATH:-.}" \ --destination "${HOME}"/buildpack \ --version "${VERSION}" fi - PACKAGE_FILE=${SOURCE_PATH:-.}/package.toml - [[ -e ${PACKAGE_FILE} ]] && cp ${PACKAGE_FILE} "${HOME}"/package.toml - printf '[buildpack]\nuri = "%s"\n\n[platform]\nos = "%s"\n' "${HOME}"/buildpack "${OS}" >> "${HOME}"/package.toml + PACKAGE_FILE="${SOURCE_PATH:-.}/package.toml" + if [ -f "${PACKAGE_FILE}" ]; then + cp "${PACKAGE_FILE}" "${HOME}/buildpack/package.toml" + printf '[buildpack]\nuri = "%s"\n\n[platform]\nos = "%s"\n' "${HOME}/buildpack" "${OS}" >> "${HOME}/buildpack/package.toml" + fi env: INCLUDE_DEPENDENCIES: "false" OS: linux @@ -142,12 +144,17 @@ jobs: run: |- #!/usr/bin/env bash - set -euo pipefail + set -xeuo pipefail + COMPILED_BUILDPACK="${HOME}/buildpack" - cp ~/package.toml ~/buildpack/package.toml - cd ~/buildpack + # create-package puts the buildpack here, we need to run from that directory + # for component buildpacks so that pack doesn't need a package.toml + cd "${COMPILED_BUILDPACK}" CONFIG="" + if [ -f "${COMPILED_BUILDPACK}/package.toml" ]; then + CONFIG="--config ${COMPILED_BUILDPACK}/package.toml" + fi PACKAGE_LIST=($PACKAGES) # Extract first repo (Docker Hub) as the main to package & register diff --git a/.github/workflows/pb-tests.yml b/.github/workflows/pb-tests.yml index e3a49ca..3ea5a37 100644 --- a/.github/workflows/pb-tests.yml +++ b/.github/workflows/pb-tests.yml @@ -93,7 +93,7 @@ jobs: run: | #!/usr/bin/env bash - set -euo pipefail + set -xeuo pipefail # With Go 1.20, we need to set this so that we produce statically compiled binaries # @@ -104,21 +104,23 @@ jobs: if [[ "${INCLUDE_DEPENDENCIES}" == "true" ]]; then create-package \ - --source ${SOURCE_PATH:-.} \ + --source "${SOURCE_PATH:-.}" \ --cache-location "${HOME}"/carton-cache \ --destination "${HOME}"/buildpack \ --include-dependencies \ --version "${VERSION}" else create-package \ - --source ${SOURCE_PATH:-.} \ + --source "${SOURCE_PATH:-.}" \ --destination "${HOME}"/buildpack \ --version "${VERSION}" fi - PACKAGE_FILE=${SOURCE_PATH:-.}/package.toml - [[ -e ${PACKAGE_FILE} ]] && cp ${PACKAGE_FILE} "${HOME}"/package.toml - printf '[buildpack]\nuri = "%s"\n\n[platform]\nos = "%s"\n' "${HOME}"/buildpack "${OS}" >> "${HOME}"/package.toml + PACKAGE_FILE="${SOURCE_PATH:-.}/package.toml" + if [ -f "${PACKAGE_FILE}" ]; then + cp "${PACKAGE_FILE}" "${HOME}/buildpack/package.toml" + printf '[buildpack]\nuri = "%s"\n\n[platform]\nos = "%s"\n' "${HOME}/buildpack" "${OS}" >> "${HOME}/buildpack/package.toml" + fi env: INCLUDE_DEPENDENCIES: "true" OS: linux @@ -127,13 +129,16 @@ jobs: run: |- #!/usr/bin/env bash - set -euo pipefail + set -xeuo pipefail + + COMPILED_BUILDPACK="${HOME}/buildpack" - CONFIG="--config "${HOME}"/package.toml" - #TODO with this, we don't need to use the package.toml, because pack exp. does not support it with multi arch yet - if ! [ -f "${PWD}/package.toml" ]; then - cd ~/buildpack - CONFIG="" + # create-package puts the buildpack here, we need to run from that directory + # for component buildpacks so that pack doesn't need a package.toml + cd "${COMPILED_BUILDPACK}" + CONFIG="" + if [ -f "${COMPILED_BUILDPACK}/package.toml" ]; then + CONFIG="--config ${COMPILED_BUILDPACK}/package.toml" fi PACKAGE_LIST=($PACKAGES) diff --git a/.github/workflows/pb-update-pipeline.yml b/.github/workflows/pb-update-pipeline.yml index 55c3e25..3e8f0a5 100644 --- a/.github/workflows/pb-update-pipeline.yml +++ b/.github/workflows/pb-update-pipeline.yml @@ -56,7 +56,10 @@ jobs: git add .github/ git add .gitignore - git add scripts/build.sh + + if [ -f scripts/build.sh ]; then + git add scripts/build.sh + fi git checkout -- .