diff --git a/.github/pipeline-version b/.github/pipeline-version index 7aa332e..5edffce 100644 --- a/.github/pipeline-version +++ b/.github/pipeline-version @@ -1 +1 @@ -1.33.0 +1.39.0 diff --git a/.github/workflows/pb-create-package.yml b/.github/workflows/pb-create-package.yml index 17c32a0..972772d 100644 --- a/.github/workflows/pb-create-package.yml +++ b/.github/workflows/pb-create-package.yml @@ -3,9 +3,6 @@ name: Create Package release: types: - published - push: - branches: - - main jobs: create-package: name: Create Package @@ -14,14 +11,14 @@ jobs: steps: - name: Docker login docker.io if: ${{ (github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork) && (github.actor != 'dependabot[bot]') }} - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: password: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD }} registry: docker.io username: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }} - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - name: Install create-package run: | #!/usr/bin/env bash @@ -29,44 +26,24 @@ jobs: set -euo pipefail go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/create-package@latest - - name: Install crane - run: | - #!/usr/bin/env bash - - set -euo pipefail - - echo "Installing crane ${CRANE_VERSION}" - - mkdir -p "${HOME}"/bin - echo "${HOME}/bin" >> "${GITHUB_PATH}" - - curl \ - --show-error \ - --silent \ - --location \ - "https://github.com/google/go-containerregistry/releases/download/v${CRANE_VERSION}/go-containerregistry_Linux_x86_64.tar.gz" \ - | tar -C "${HOME}/bin" -xz crane - env: - CRANE_VERSION: 0.8.0 + - uses: buildpacks/github-actions/setup-tools@v5.6.0 + with: + crane-version: 0.19.1 + yj-version: 5.1.0 - name: Install pack run: | #!/usr/bin/env bash - + # this is coming from a copy of https://github.com/buildpacks/pack/actions/runs/8118576298 stored on box + # TODO to revisit when the official one is out set -euo pipefail - echo "Installing pack ${PACK_VERSION}" + echo "Installing pack experimental" mkdir -p "${HOME}"/bin echo "${HOME}/bin" >> "${GITHUB_PATH}" - curl \ - --location \ - --show-error \ - --silent \ - "https://github.com/buildpacks/pack/releases/download/v${PACK_VERSION}/pack-v${PACK_VERSION}-linux.tgz" \ - | tar -C "${HOME}"/bin -xz pack - env: - PACK_VERSION: 0.29.0 + curl -L "https://ent.box.com/shared/static/j4d1bfe9uk1sb0i7zjvci0md9xmy41u4" -o ${HOME}/bin/pack + chmod +x "${HOME}"/bin/pack - name: Enable pack Experimental if: ${{ false }} run: | @@ -78,9 +55,9 @@ jobs: mkdir -p "${HOME}"/.pack echo "experimental = true" >> "${HOME}"/.pack/config.toml - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - if: ${{ false }} - uses: actions/cache@v3 + uses: actions/cache@v4 with: key: ${{ runner.os }}-go-${{ hashFiles('**/buildpack.toml', '**/package.toml') }} path: |- @@ -94,8 +71,8 @@ jobs: set -euo pipefail - if [ -z "${GITHUB_REF+set}" ]; then - echo "GITHUB_REF set to [${GITHUB_REF-}], but should never be empty or unset" + if [[ ${GITHUB_REF:-} != "refs/"* ]]; then + echo "GITHUB_REF set to [${GITHUB_REF:-}], but that is unexpected. It should start with 'refs/*'" exit 255 fi @@ -133,21 +110,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 @@ -160,15 +139,23 @@ jobs: set -euo pipefail + 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) # Extract first repo (Docker Hub) as the main to package & register PACKAGE=${PACKAGE_LIST[0]} if [[ "${PUBLISH:-x}" == "true" ]]; then - pack buildpack package \ - "${PACKAGE}:${VERSION}" \ - --config "${HOME}"/package.toml \ + pack -v buildpack package \ + "${PACKAGE}:${VERSION}" ${CONFIG} \ --publish if [[ -n ${VERSION_MINOR:-} && -n ${VERSION_MAJOR:-} ]]; then @@ -192,10 +179,9 @@ jobs: done else - pack buildpack package \ - "${PACKAGE}:${VERSION}" \ - --config "${HOME}"/package.toml \ - --format "${FORMAT}" + pack -v buildpack package \ + "${PACKAGE}:${VERSION}" ${CONFIG} \ + --format "${FORMAT}" $([ -n "$TTL_SH_PUBLISH" ] && [ "$TTL_SH_PUBLISH" = "true" ] && echo "--publish") fi env: PACKAGES: docker.io/garethjevans/ytt @@ -226,7 +212,7 @@ jobs: DIGEST: ${{ steps.package.outputs.digest }} GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} - if: ${{ true }} - uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:4.0.1 + uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:5.6.0 with: address: docker.io/garethjevans/ytt@${{ steps.package.outputs.digest }} id: garethjevans/ytt diff --git a/.github/workflows/pb-minimal-labels.yml b/.github/workflows/pb-minimal-labels.yml index 75ea2ac..767ff02 100644 --- a/.github/workflows/pb-minimal-labels.yml +++ b/.github/workflows/pb-minimal-labels.yml @@ -12,7 +12,7 @@ jobs: runs-on: - ubuntu-latest steps: - - uses: mheap/github-action-required-labels@v4 + - uses: mheap/github-action-required-labels@v5 with: count: 1 labels: semver:major, semver:minor, semver:patch @@ -22,7 +22,7 @@ jobs: runs-on: - ubuntu-latest steps: - - uses: mheap/github-action-required-labels@v4 + - uses: mheap/github-action-required-labels@v5 with: count: 1 labels: type:bug, type:dependency-upgrade, type:documentation, type:enhancement, type:question, type:task diff --git a/.github/workflows/pb-synchronize-labels.yml b/.github/workflows/pb-synchronize-labels.yml index 8f93206..21464b5 100644 --- a/.github/workflows/pb-synchronize-labels.yml +++ b/.github/workflows/pb-synchronize-labels.yml @@ -11,7 +11,7 @@ jobs: runs-on: - ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: micnncim/action-label-syncer@v1 env: GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/pb-tests.yml b/.github/workflows/pb-tests.yml index d410184..5b721da 100644 --- a/.github/workflows/pb-tests.yml +++ b/.github/workflows/pb-tests.yml @@ -17,14 +17,14 @@ jobs: steps: - name: Docker login docker.io if: ${{ (github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork) && (github.actor != 'dependabot[bot]') }} - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: password: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD }} registry: docker.io username: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }} - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - name: Install create-package run: | #!/usr/bin/env bash @@ -35,22 +35,17 @@ jobs: - name: Install pack run: | #!/usr/bin/env bash - + # this is coming from a copy of https://github.com/buildpacks/pack/actions/runs/8118576298 stored on box + # TODO to revisit when the official one is out set -euo pipefail - echo "Installing pack ${PACK_VERSION}" + echo "Installing pack experimental" mkdir -p "${HOME}"/bin echo "${HOME}/bin" >> "${GITHUB_PATH}" - curl \ - --location \ - --show-error \ - --silent \ - "https://github.com/buildpacks/pack/releases/download/v${PACK_VERSION}/pack-v${PACK_VERSION}-linux.tgz" \ - | tar -C "${HOME}"/bin -xz pack - env: - PACK_VERSION: 0.29.0 + curl -L "https://ent.box.com/shared/static/j4d1bfe9uk1sb0i7zjvci0md9xmy41u4" -o ${HOME}/bin/pack + chmod +x "${HOME}"/bin/pack - name: Enable pack Experimental if: ${{ false }} run: | @@ -62,8 +57,8 @@ jobs: mkdir -p "${HOME}"/.pack echo "experimental = true" >> "${HOME}"/.pack/config.toml - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: key: ${{ runner.os }}-go-${{ hashFiles('**/buildpack.toml', '**/package.toml') }} path: |- @@ -77,8 +72,8 @@ jobs: set -euo pipefail - if [ -z "${GITHUB_REF+set}" ]; then - echo "GITHUB_REF set to [${GITHUB_REF-}], but should never be empty or unset" + if [[ ${GITHUB_REF:-} != "refs/"* ]]; then + echo "GITHUB_REF set to [${GITHUB_REF:-}], but that is unexpected. It should start with 'refs/*'" exit 255 fi @@ -116,21 +111,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 @@ -141,15 +138,23 @@ jobs: set -euo pipefail + 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) # Extract first repo (Docker Hub) as the main to package & register PACKAGE=${PACKAGE_LIST[0]} if [[ "${PUBLISH:-x}" == "true" ]]; then - pack buildpack package \ - "${PACKAGE}:${VERSION}" \ - --config "${HOME}"/package.toml \ + pack -v buildpack package \ + "${PACKAGE}:${VERSION}" ${CONFIG} \ --publish if [[ -n ${VERSION_MINOR:-} && -n ${VERSION_MAJOR:-} ]]; then @@ -173,29 +178,29 @@ jobs: done else - pack buildpack package \ - "${PACKAGE}:${VERSION}" \ - --config "${HOME}"/package.toml \ - --format "${FORMAT}" + pack -v buildpack package \ + "${PACKAGE}:${VERSION}" ${CONFIG} \ + --format "${FORMAT}" $([ -n "$TTL_SH_PUBLISH" ] && [ "$TTL_SH_PUBLISH" = "true" ] && echo "--publish") fi env: FORMAT: image PACKAGES: test + TTL_SH_PUBLISH: "false" VERSION: ${{ steps.version.outputs.version }} unit: name: Unit Test runs-on: - ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/cache@v3 + - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} path: ${{ env.HOME }}/go/pkg/mod restore-keys: ${{ runner.os }}-go- - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - name: Install richgo run: | #!/usr/bin/env bash diff --git a/.github/workflows/pb-update-draft-release.yml b/.github/workflows/pb-update-draft-release.yml index 2aae7bf..48e91ab 100644 --- a/.github/workflows/pb-update-draft-release.yml +++ b/.github/workflows/pb-update-draft-release.yml @@ -13,7 +13,7 @@ jobs: uses: release-drafter/release-drafter@v5 env: GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update draft release with buildpack information uses: docker://ghcr.io/paketo-buildpacks/actions/draft-release:main with: diff --git a/.github/workflows/pb-update-go.yml b/.github/workflows/pb-update-go.yml index 4eceb2e..dac810a 100644 --- a/.github/workflows/pb-update-go.yml +++ b/.github/workflows/pb-update-go.yml @@ -9,10 +9,10 @@ jobs: runs-on: - ubuntu-latest steps: - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.20" - - uses: actions/checkout@v3 + go-version: "1.22" + - uses: actions/checkout@v4 - name: Update Go Version & Modules id: update-go run: | @@ -49,8 +49,8 @@ jobs: echo "commit-body=${COMMIT_BODY}" >> "$GITHUB_OUTPUT" echo "commit-semver=${COMMIT_SEMVER}" >> "$GITHUB_OUTPUT" env: - GO_VERSION: "1.20" - - uses: peter-evans/create-pull-request@v5 + GO_VERSION: "1.22" + - uses: peter-evans/create-pull-request@v6 with: author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> body: |- diff --git a/.github/workflows/pb-update-pipeline.yml b/.github/workflows/pb-update-pipeline.yml index cfe2527..2c05223 100644 --- a/.github/workflows/pb-update-pipeline.yml +++ b/.github/workflows/pb-update-pipeline.yml @@ -14,9 +14,9 @@ jobs: runs-on: - ubuntu-latest steps: - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - name: Install octo run: | #!/usr/bin/env bash @@ -24,7 +24,7 @@ jobs: set -euo pipefail go install -ldflags="-s -w" github.com/paketo-buildpacks/pipeline-builder/cmd/octo@latest - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Update Pipeline id: pipeline run: | @@ -55,6 +55,12 @@ jobs: ) git add .github/ + git add .gitignore + + if [ -f scripts/build.sh ]; then + git add scripts/build.sh + fi + git checkout -- . echo "old-version=${OLD_VERSION}" >> "$GITHUB_OUTPUT" @@ -65,7 +71,7 @@ jobs: env: DESCRIPTOR: .github/pipeline-descriptor.yml GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} - - uses: peter-evans/create-pull-request@v5 + - uses: peter-evans/create-pull-request@v6 with: author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> body: |- diff --git a/.github/workflows/pb-update-ytt-cli.yml b/.github/workflows/pb-update-ytt-cli.yml index 3f9e1b7..d1b9f75 100644 --- a/.github/workflows/pb-update-ytt-cli.yml +++ b/.github/workflows/pb-update-ytt-cli.yml @@ -9,9 +9,9 @@ jobs: runs-on: - ubuntu-latest steps: - - uses: actions/setup-go@v4 + - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - name: Install update-buildpack-dependency run: | #!/usr/bin/env bash @@ -19,28 +19,11 @@ jobs: set -euo pipefail go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/update-buildpack-dependency@latest - - name: Install yj - run: | - #!/usr/bin/env bash - - set -euo pipefail - - echo "Installing yj ${YJ_VERSION}" - - mkdir -p "${HOME}"/bin - echo "${HOME}/bin" >> "${GITHUB_PATH}" - - curl \ - --location \ - --show-error \ - --silent \ - --output "${HOME}"/bin/yj \ - "https://github.com/sclevine/yj/releases/download/v${YJ_VERSION}/yj-linux" - - chmod +x "${HOME}"/bin/yj - env: - YJ_VERSION: 5.0.0 - - uses: actions/checkout@v3 + - uses: buildpacks/github-actions/setup-tools@v5.6.0 + with: + crane-version: 0.19.1 + yj-version: 5.1.0 + - uses: actions/checkout@v4 - id: dependency uses: docker://ghcr.io/paketo-buildpacks/actions/github-release-dependency:main with: @@ -56,15 +39,19 @@ jobs: set -euo pipefail - OLD_VERSION=$(yj -tj < buildpack.toml | jq -r " - .metadata.dependencies[] | - select( .id == env.ID ) | - select( .version | test( env.VERSION_PATTERN ) ) | - .version") + VERSION_DEPS=$(yj -tj < buildpack.toml | jq -r ".metadata.dependencies[] | select( .id == env.ID ) | select( .version | test( env.VERSION_PATTERN ) )") + ARCH=${ARCH:-amd64} + OLD_VERSION=$(echo "$VERSION_DEPS" | jq -r 'select( .purl | contains( env.ARCH ) ) | .version') + + if [ -z "$OLD_VERSION" ]; then + ARCH="" # empty means noarch + OLD_VERSION=$(echo "$VERSION_DEPS" | jq -r ".version") + fi update-buildpack-dependency \ --buildpack-toml buildpack.toml \ --id "${ID}" \ + --arch "${ARCH}" \ --version-pattern "${VERSION_PATTERN}" \ --version "${VERSION}" \ --cpe-pattern "${CPE_PATTERN:-}" \ @@ -72,7 +59,9 @@ jobs: --purl-pattern "${PURL_PATTERN:-}" \ --purl "${PURL:-}" \ --uri "${URI}" \ - --sha256 "${SHA256}" + --sha256 "${SHA256}" \ + --source "${SOURCE_URI}" \ + --source-sha256 "${SOURCE_SHA256}" git add buildpack.toml git checkout -- . @@ -89,16 +78,19 @@ jobs: echo "new-version=${VERSION}" >> "$GITHUB_OUTPUT" echo "version-label=${LABEL}" >> "$GITHUB_OUTPUT" env: + ARCH: "" CPE: ${{ steps.dependency.outputs.cpe }} CPE_PATTERN: "" ID: ytt PURL: ${{ steps.dependency.outputs.purl }} PURL_PATTERN: "" SHA256: ${{ steps.dependency.outputs.sha256 }} + SOURCE_SHA256: ${{ steps.dependency.outputs.source_sha256 }} + SOURCE_URI: ${{ steps.dependency.outputs.source }} URI: ${{ steps.dependency.outputs.uri }} VERSION: ${{ steps.dependency.outputs.version }} VERSION_PATTERN: '[\d]+\.[\d]+\.[\d]+' - - uses: peter-evans/create-pull-request@v5 + - uses: peter-evans/create-pull-request@v6 with: author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> body: Bumps `Ytt CLI` from `${{ steps.buildpack.outputs.old-version }}` to `${{ steps.buildpack.outputs.new-version }}`.