Skip to content

Commit

Permalink
Two fixes for pipeline-builder
Browse files Browse the repository at this point in the history
1. Minor fix in update-pipeline.sh. It tries to add the build script even if that might not exist. This causes the job to fail for composite buildpacks.

2. Update create and package buildpack scripts such that they work and run out of the generated buildpack directory. This helps with a pack limitation that does not let you publish images when the `package.toml` file lives outside of the buildpack directory.

2.) fixes the following error:

```
pack -v buildpack package docker.io/dmikusa/rust -c ../package.toml --publish
Warning: A new '--target' flag is available to set the platform for the buildpack package, using 'linux' as default
Downloading buildpack from URI: file:///Users/dmikusa/Code/OSS/paketo-community/rust
Downloading buildpack dependency for platform linux
Downloading buildpack from image: docker.io/paketocommunity/rustup:1.11.0
ERROR: packaging dependencies (uri=docker://docker.io/paketocommunity/rustup:1.11.0,image=): extracting from registry docker://docker.io/paketocommunity/rustup:1.11.0: extracting buildpacks from docker.io/paketocommunity/rustup:1.11.0: could not find label io.buildpacks.buildpackage.metadata
```

Signed-off-by: Daniel Mikusa <[email protected]>
  • Loading branch information
dmikusa committed Apr 1, 2024
1 parent 0ce84c3 commit 6c5e356
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
14 changes: 8 additions & 6 deletions octo/create-package.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/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
#
Expand All @@ -11,18 +11,20 @@ export CGO_ENABLED=0

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
15 changes: 9 additions & 6 deletions octo/package-buildpack.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/usr/bin/env bash

set -euo pipefail
set -xeuo pipefail

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=""
COMPILED_BUILDPACK="${HOME}/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)
Expand Down
2 changes: 1 addition & 1 deletion octo/statik/statik.go

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion octo/update-pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ RELEASE_NOTES=$(

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 -- .

Expand Down

0 comments on commit 6c5e356

Please sign in to comment.