Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #9 from paketo-buildpacks/pull-request-target
Browse files Browse the repository at this point in the history
Docker Login Improvements
  • Loading branch information
ekcasey authored Oct 15, 2020
2 parents 3387e5c + fafba71 commit 34f44b2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/create-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ jobs:
runs-on:
- ubuntu-latest
steps:
- name: Docker login gcr.io
- if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }}
name: Docker login gcr.io
uses: docker/login-action@v1
with:
password: ${{ secrets.JAVA_GCLOUD_SERVICE_ACCOUNT_KEY }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ jobs:
runs-on:
- ubuntu-latest
steps:
- name: Docker login gcr.io
- if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }}
name: Docker login gcr.io
uses: docker/login-action@v1
with:
password: ${{ secrets.JAVA_GCLOUD_SERVICE_ACCOUNT_KEY }}
Expand Down
52 changes: 35 additions & 17 deletions .github/workflows/update-draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ jobs:
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Docker login gcr.io
uses: docker/login-action@v1
with:
password: ${{ secrets.JAVA_GCLOUD_SERVICE_ACCOUNT_KEY }}
registry: gcr.io
username: _json_key
- uses: actions/checkout@v2
- name: Install yj
run: |
Expand All @@ -45,31 +39,55 @@ jobs:
set -euo pipefail
PAYLOAD=$(yj -tj < buildpack.toml | jq '{ primary: . }')
PAYLOAD="{}"
if [[ -e buildpack.toml ]]; then
PAYLOAD=$(jq -n -r \
--argjson PAYLOAD "${PAYLOAD}" \
--argjson BUILDPACK "$(yj -tj < buildpack.toml)" \
'$PAYLOAD | .primary = $BUILDPACK')
fi
if [[ -e builder.toml ]]; then
PAYLOAD=$(jq -n -r \
--argjson PAYLOAD "${PAYLOAD}" \
--argjson BUILDER "$(yj -tj < builder.toml)" \
'$PAYLOAD | .primary = $BUILDER')
for BUILDPACK in $(
jq -n -r \
--argjson PAYLOAD "${PAYLOAD}" \
'$PAYLOAD.primary.buildpacks[].image'
); do
crane export "${BUILDPACK}" - | tar xf - --absolute-names --strip-components 1 --wildcards "/cnb/buildpacks/*/*/buildpack.toml"
done
fi
if [[ -e package.toml ]]; then
for PACKAGE in $(yj -t < package.toml | jq -r '.dependencies[].image'); do
PAYLOAD=$(jq -n -r \
--argjson PAYLOAD "${PAYLOAD}" \
--argjson BUILDPACK "$(crane export "${PACKAGE}" - \
| tar xOf - --absolute-names --wildcards "/cnb/buildpacks/*/*/buildpack.toml" \
| yj -tj)" \
'$PAYLOAD | .buildpacks += [ $BUILDPACK ]')
crane export "${PACKAGE}" - | tar xf - --absolute-names --strip-components 1 --wildcards "/cnb/buildpacks/*/*/buildpack.toml"
done
fi
while IFS= read -r -d '' FILE; do
PAYLOAD=$(jq -n -r \
--argjson PAYLOAD "${PAYLOAD}" \
--argjson BUILDPACK "$(yj -tj < "${FILE}")" \
'$PAYLOAD | .buildpacks += [ $BUILDPACK ]')
done < <(find buildpacks -name buildpack.toml -print0)
jq -n -r \
--argjson PAYLOAD "${PAYLOAD}" \
--arg RELEASE_NAME "${RELEASE_NAME}" \
'"\($PAYLOAD.primary.buildpack.name) \($RELEASE_NAME)"' \
'( select($PAYLOAD.primary.buildpack.name) | "\($PAYLOAD.primary.buildpack.name) \($RELEASE_NAME)" ) // "\($RELEASE_NAME)"' \
> "${HOME}"/name
jq -n -r \
--argjson PAYLOAD "${PAYLOAD}" \
--arg RELEASE_BODY "${RELEASE_BODY}" \
'
def id(b):
"**ID**: `\(b.buildpack.id)`"
select(b.buildpack.id) | "**ID**: `\(b.buildpack.id)`"
;
def included_buildpackages(b): [
Expand Down Expand Up @@ -98,7 +116,7 @@ jobs:
"#### Dependencies:",
"Name | Version | SHA256",
":--- | :------ | :-----",
( d | sort_by(.name | ascii_downcase) | map("\(.name) | `\(.version)` | `\(.sha256)`")),
( d | sort_by(.name // .id | ascii_downcase) | map("\(.name // .id) | `\(.version)` | `\(.sha256)`")),
""
];
Expand All @@ -109,7 +127,7 @@ jobs:
( o | map([
"ID | Version | Optional",
":- | :------ | :-------",
( .group | map([ "`\(.id)` | `\(.version)`", ( select(.optional) | "| `\(.optional)`" ) ] | join(" ")) ),
( .group | map([ "`\(.id)` | ", (select(.version) | "`\(.version)`"), ( select(.optional) | "| `\(.optional)`" ) ] | join(" ")) ),
""
])),
"</details>",
Expand Down

0 comments on commit 34f44b2

Please sign in to comment.