Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sophie Wigmore committed Mar 18, 2024
1 parent 6ccad49 commit c164be7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

#TODO:

Check warning on line 20 in .github/workflows/test-builder.yml

View workflow job for this annotation

GitHub Actions / lintYaml

20:5 [comments] missing starting space in comment
#Test against ARM64 - need a runner?

Check warning on line 21 in .github/workflows/test-builder.yml

View workflow job for this annotation

GitHub Actions / lintYaml

21:5 [comments] missing starting space in comment
- name: Run Smoke Tests
run: ./scripts/smoke.sh
3 changes: 0 additions & 3 deletions .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v3


#TODO:

Check warning on line 22 in .github/workflows/test-pull-request.yml

View workflow job for this annotation

GitHub Actions / lintYaml

22:5 [comments] missing starting space in comment
#Install experimental pack
#Test against ARM64 - need a runner?

Check warning on line 23 in .github/workflows/test-pull-request.yml

View workflow job for this annotation

GitHub Actions / lintYaml

23:5 [comments] missing starting space in comment
#Push builder image to local registry

- name: Run Smoke Tests
run: ./scripts/smoke.sh
Expand Down
26 changes: 23 additions & 3 deletions scripts/smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function main() {
name="localhost:5000/${name}"

# tools::install "${token}"
experimental::pack::install "${token}"

container_id=$(local_registry::run)
builder::create "${name}"
Expand Down Expand Up @@ -84,6 +85,24 @@ function tools::install() {
--token "${token}"
}

# TODO: when an official pack release comes out that supports multi-arch, use that
# Until then, use an experimental pack version we've saved to a shared location
function experimental::pack::install() {
echo "Installing pack experimental"

artifact_uri="https://api.github.com/repos/buildpacks/pack/actions/artifacts/1306588326/zip"
os=$(util::tools::os)
if [[ ${os} == "linux" ]]; then
artifact_uri="https://api.github.com/repos/buildpacks/pack/actions/artifacts/1306592515/zip"
fi

mkdir -p "${BUILDERDIR}/.bin"
curl -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${token}" "${artifact_uri}" \
-o "${BUILDERDIR}/.bin/pack.zip"
unzip "${BUILDERDIR}/.bin/pack.zip" -d "${BUILDERDIR}/.bin"
chmod +x "${BUILDERDIR}/.bin/pack"
}

function local_registry::run() {
container_id=$(docker run --rm -d -p 5000:5000 --name registry registry:2.7)
echo $container_id
Expand All @@ -106,16 +125,17 @@ function builder::create() {
name="${1}"

util::print::title "Creating builder..."
# TODO Fix pack
"${BUILDERDIR}"/pack builder create "${name}" --config "${BUILDERDIR}/builder.toml"
# TODO: when a regular pack release is out, revert this to `pack`
"${BUILDERDIR}"/.bin/pack builder create "${name}" --config "${BUILDERDIR}/builder.toml"
}

function image::pull::lifecycle() {
local name lifecycle_image
name="${1}"

# TODO: when a regular pack release is out, revert this to `BUILDERDIR/pack`
lifecycle_image="index.docker.io/buildpacksio/lifecycle:$(
"${BUILDERDIR}"/pack builder inspect "${name}" --output json \
"${BUILDERDIR}"/.bin/pack builder inspect "${name}" --output json \
| jq -r '.local_info.lifecycle.version'
)"

Expand Down

0 comments on commit c164be7

Please sign in to comment.