Skip to content

Commit

Permalink
Initial content
Browse files Browse the repository at this point in the history
Signed-off-by: Ozzy Osborne <[email protected]>
  • Loading branch information
BarDweller committed Jul 18, 2023
1 parent 1e15e0e commit 31ed899
Show file tree
Hide file tree
Showing 27 changed files with 1,617 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @paketo-buildpacks/java-maintainers
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: daily
ignore:
- dependency-name: github.com/onsi/gomega
labels:
- semver:patch
- type:dependency-upgrade
42 changes: 42 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
- name: semver:major
description: A change requiring a major version bump
color: f9d0c4
- name: semver:minor
description: A change requiring a minor version bump
color: f9d0c4
- name: semver:patch
description: A change requiring a patch version bump
color: f9d0c4
- name: type:bug
description: A general bug
color: e3d9fc
- name: type:dependency-upgrade
description: A dependency upgrade
color: e3d9fc
- name: type:documentation
description: A documentation update
color: e3d9fc
- name: type:enhancement
description: A general enhancement
color: e3d9fc
- name: type:question
description: A user question
color: e3d9fc
- name: type:task
description: A general task
color: e3d9fc
- name: type:informational
description: Provides information or notice to the community
color: e3d9fc
- name: type:poll
description: Request for feedback from the community
color: e3d9fc
- name: note:ideal-for-contribution
description: An issue that a contributor can help us with
color: 54f7a8
- name: note:on-hold
description: We can't start working on this issue yet
color: 54f7a8
- name: note:good-first-issue
description: A good first issue to get started with
color: 54f7a8
30 changes: 30 additions & 0 deletions .github/pipeline-descriptor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
github:
username: ${{ secrets.JAVA_GITHUB_USERNAME }}
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}

codeowners:
- path: "*"
owner: "@paketo-buildpacks/java-maintainers"

package:
repositories: ["docker.io/paketobuildpacks/pipeline-builder-stool-pigeon","gcr.io/paketo-buildpacks/pipeline-builder-stool-pigeon"]
register: true
registry_token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}

docker_credentials:
- registry: gcr.io
username: _json_key
password: ${{ secrets.GCR_PUSH_BOT_JSON_KEY }}
- registry: docker.io
username: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }}
password: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD }}

dependencies:
- id: maven
uses: docker://ghcr.io/paketo-buildpacks/actions/maven-dependency:main
with:
uri: https://repo1.maven.org/maven2
group_id: org.apache.maven
artifact_id: apache-maven
classifier: bin
packaging: tar.gz
32 changes: 32 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
template: $CHANGES
name-template: $RESOLVED_VERSION
tag-template: v$RESOLVED_VERSION
categories:
- title: ⭐️ Enhancements
labels:
- type:enhancement
- title: "\U0001F41E Bug Fixes"
labels:
- type:bug
- title: "\U0001F4D4 Documentation"
labels:
- type:documentation
- title: ⛏ Dependency Upgrades
labels:
- type:dependency-upgrade
- title: "\U0001F6A7 Tasks"
labels:
- type:task
exclude-labels:
- type:question
version-resolver:
major:
labels:
- semver:major
minor:
labels:
- semver:minor
patch:
labels:
- semver:patch
default: patch
253 changes: 253 additions & 0 deletions .github/workflows/pb-create-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
name: Create Package
"on":
release:
types:
- published
jobs:
create-package:
name: Create Package
runs-on:
- ubuntu-latest
steps:
- name: Docker login gcr.io
if: ${{ (github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork) && (github.actor != 'dependabot[bot]') }}
uses: docker/login-action@v2
with:
password: ${{ secrets.GCR_PUSH_BOT_JSON_KEY }}
registry: gcr.io
username: _json_key
- 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
with:
password: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD }}
registry: docker.io
username: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }}
- uses: actions/setup-go@v4
with:
go-version: "1.20"
- name: Install create-package
run: |
#!/usr/bin/env bash
set -euo pipefail
go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/create-package@${PAKETO_LIBPAK_COMMIT:=latest}
env:
PAKETO_LIBPAK_COMMIT: ${{ vars.PAKETO_LIBPAK_COMMIT }}
- 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
- name: Install pack
run: |
#!/usr/bin/env bash
set -euo pipefail
echo "Installing pack ${PACK_VERSION}"
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.30.0-pre2
- name: Enable pack Experimental
if: ${{ false }}
run: |
#!/usr/bin/env bash
set -euo pipefail
echo "Enabling pack experimental features"
mkdir -p "${HOME}"/.pack
echo "experimental = true" >> "${HOME}"/.pack/config.toml
- uses: actions/checkout@v3
- if: ${{ false }}
uses: actions/cache@v3
with:
key: ${{ runner.os }}-go-${{ hashFiles('**/buildpack.toml', '**/package.toml') }}
path: |-
${{ env.HOME }}/.pack
${{ env.HOME }}/carton-cache
restore-keys: ${{ runner.os }}-go-
- name: Compute Version
id: version
run: |
#!/usr/bin/env bash
set -euo pipefail
if [ -z "${GITHUB_REF+set}" ]; then
echo "GITHUB_REF set to [${GITHUB_REF-<unset>}], but should never be empty or unset"
exit 255
fi
if [[ ${GITHUB_REF} =~ refs/tags/v([0-9]+\.[0-9]+\.[0-9]+) ]]; then
VERSION=${BASH_REMATCH[1]}
MAJOR_VERSION="$(echo "${VERSION}" | awk -F '.' '{print $1 }')"
MINOR_VERSION="$(echo "${VERSION}" | awk -F '.' '{print $1 "." $2 }')"
echo "version-major=${MAJOR_VERSION}" >> "$GITHUB_OUTPUT"
echo "version-minor=${MINOR_VERSION}" >> "$GITHUB_OUTPUT"
elif [[ ${GITHUB_REF} =~ refs/heads/(.+) ]]; then
VERSION=${BASH_REMATCH[1]}
else
VERSION=$(git rev-parse --short HEAD)
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Selected ${VERSION} from
* ref: ${GITHUB_REF}
* sha: ${GITHUB_SHA}
"
- name: Create Package
run: |
#!/usr/bin/env bash
set -euo pipefail
# With Go 1.20, we need to set this so that we produce statically compiled binaries
#
# Starting with Go 1.20, Go will produce binaries that are dynamically linked against libc
# which can cause compatibility issues. The compiler links against libc on the build system
# but that may be newer than on the stacks we support.
export CGO_ENABLED=0
if [[ "${EXTENSION:-x}" == "true" ]]; then
export PACK_MODULE_TYPE=extension
else
export PACK_MODULE_TYPE=buildpack
fi
if [[ "${INCLUDE_DEPENDENCIES}" == "true" ]]; then
create-package \
--source ${SOURCE_PATH:-.} \
--cache-location "${HOME}"/carton-cache \
--destination "${HOME}"/${PACK_MODULE_TYPE} \
--include-dependencies \
--version "${VERSION}"
else
create-package \
--source ${SOURCE_PATH:-.} \
--destination "${HOME}"/${PACK_MODULE_TYPE} \
--version "${VERSION}"
fi
PACKAGE_FILE=${SOURCE_PATH:-.}/package.toml
[[ -e ${PACKAGE_FILE} ]] && cp ${PACKAGE_FILE} "${HOME}"/package.toml
printf '['${PACK_MODULE_TYPE}']\nuri = "%s"\n\n[platform]\nos = "%s"\n' "${HOME}"/${PACK_MODULE_TYPE} "${OS}" >> "${HOME}"/package.toml
env:
EXTENSION: "true"
INCLUDE_DEPENDENCIES: "false"
OS: linux
SOURCE_PATH: ""
VERSION: ${{ steps.version.outputs.version }}
- name: Package Buildpack/Extension
id: package
run: |-
#!/usr/bin/env bash
set -euo pipefail
PACKAGE_LIST=($PACKAGES)
# Extract first repo (Docker Hub) as the main to package & register
PACKAGE=${PACKAGE_LIST[0]}
if [[ "${EXTENSION:-x}" == "true" ]]; then
export PACK_MODULE_TYPE=extension
else
export PACK_MODULE_TYPE=buildpack
fi
if [[ "${PUBLISH:-x}" == "true" ]]; then
pack ${PACK_MODULE_TYPE} package \
"${PACKAGE}:${VERSION}" \
--config "${HOME}"/package.toml \
--publish
if [[ -n ${VERSION_MINOR:-} && -n ${VERSION_MAJOR:-} ]]; then
crane tag "${PACKAGE}:${VERSION}" "${VERSION_MINOR}"
crane tag "${PACKAGE}:${VERSION}" "${VERSION_MAJOR}"
fi
crane tag "${PACKAGE}:${VERSION}" latest
echo "digest=$(crane digest "${PACKAGE}:${VERSION}")" >> "$GITHUB_OUTPUT"
# copy to other repositories specified
for P in "${PACKAGE_LIST[@]}"
do
if [ "$P" != "$PACKAGE" ]; then
crane copy "${PACKAGE}:${VERSION}" "${P}:${VERSION}"
if [[ -n ${VERSION_MINOR:-} && -n ${VERSION_MAJOR:-} ]]; then
crane tag "${P}:${VERSION}" "${VERSION_MINOR}"
crane tag "${P}:${VERSION}" "${VERSION_MAJOR}"
fi
crane tag "${P}:${VERSION}" latest
fi
done
else
pack ${PACK_MODULE_TYPE} package \
"${PACKAGE}:${VERSION}" \
--config "${HOME}"/package.toml \
--format "${FORMAT}"
fi
env:
EXTENSION: "true"
PACKAGES: docker.io/paketobuildpacks/pipeline-builder-stool-pigeon gcr.io/paketo-buildpacks/pipeline-builder-stool-pigeon
PUBLISH: "true"
VERSION: ${{ steps.version.outputs.version }}
VERSION_MAJOR: ${{ steps.version.outputs.version-major }}
VERSION_MINOR: ${{ steps.version.outputs.version-minor }}
- name: Update release with digest
run: |
#!/usr/bin/env bash
set -euo pipefail
PAYLOAD=$(cat "${GITHUB_EVENT_PATH}")
RELEASE_ID=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.id')
RELEASE_TAG_NAME=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.tag_name')
RELEASE_NAME=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.name')
RELEASE_BODY=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.release.body')
gh api \
--method PATCH \
"/repos/:owner/:repo/releases/${RELEASE_ID}" \
--field "tag_name=${RELEASE_TAG_NAME}" \
--field "name=${RELEASE_NAME}" \
--field "body=${RELEASE_BODY//<!-- DIGEST PLACEHOLDER -->/\`${DIGEST}\`}"
env:
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
with:
address: docker.io/paketobuildpacks/pipeline-builder-stool-pigeon@${{ steps.package.outputs.digest }}
id: paketo-buildpacks/pipeline-builder-stool-pigeon
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
version: ${{ steps.version.outputs.version }}
Loading

0 comments on commit 31ed899

Please sign in to comment.