Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
edmorley committed Apr 19, 2024
1 parent 47029de commit a043c3e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 119 deletions.
106 changes: 2 additions & 104 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Build, Test, Publish
on:
pull_request:
push:
branches: ["main"]
schedule:
- cron: "0 0 * * 1-5"
workflow_dispatch:
Expand All @@ -25,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
builder: ["buildpacks-20", "builder-classic-22", "builder-20", "builder-22", "salesforce-functions"]
builder: ["buildpacks-20", "builder-classic-22"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -58,7 +57,7 @@ jobs:
strategy:
fail-fast: false
matrix:
builder: ["buildpacks-20", "builder-classic-22", "builder-20", "builder-22"]
builder: ["buildpacks-20", "builder-classic-22"]
language: ["go", "gradle", "java", "node-js", "php", "python", "ruby", "scala"]
include:
- builder: builder-classic-22
Expand Down Expand Up @@ -97,104 +96,3 @@ jobs:
[[ -f response.txt ]] && cat response.txt
exit 1
fi
test-functions:
runs-on: ubuntu-22.04
needs: create
strategy:
fail-fast: false
matrix:
builder: ["salesforce-functions"]
language: ["java", "javascript", "typescript"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Pack CLI
uses: buildpacks/github-actions/setup-pack@v5.5.4
with:
# Using an older version of Pack CLI here (that only supports Platform API <= 0.9),
# for testing parity with the Platform API version used by Kodon for Functions:
# https://github.com/buildpacks/pack/blob/v0.27.0/internal/build/lifecycle_executor.go#L30
# https://github.com/heroku/kodon/blob/functions_eol/internal/constants/constants.go#L75
pack-version: "0.27.0"
- name: Restore Docker images from the cache
uses: actions/cache/restore@v4
with:
fail-on-cache-miss: true
key: ${{ github.run_id}}-${{ matrix.builder }}
path: images.tar.zst
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Load Docker images into the Docker daemon
run: zstd -dc --long=31 images.tar.zst | docker load
- name: Build example function image
run: pack build example-function --path salesforce-functions/examples/${{ matrix.language }} --builder ${{ matrix.builder }} --trust-builder --pull-policy never
- name: Start example function image
run: docker run --name example-function --detach -p 8080:8080 --env PORT=8080 --env DYNO=web.1 example-function
- name: Test example function web server response
run: |
if curl -sSf --retry 10 --retry-delay 1 --retry-all-errors --connect-timeout 3 -X POST -H 'x-health-check: true' http://localhost:8080 -o response.txt; then
echo "Successful response from function"
else
echo "Function did not respond successfully"
docker logs example-function
[[ -f response.txt ]] && cat response.txt
exit 1
fi
publish:
runs-on: ubuntu-22.04
if: success() && github.ref == 'refs/heads/main'
needs: ["test-guides", "test-functions"]
strategy:
fail-fast: false
matrix:
include:
- builder: buildpacks-20
tag_public: heroku/buildpacks:20
- builder: builder-classic-22
tag_public: heroku/builder-classic:22
- builder: builder-20
tag_public: heroku/builder:20
- builder: builder-22
tag_public: heroku/builder:22
- builder: salesforce-functions
tag_private: heroku-22:builder-functions
steps:
- name: Restore Docker images from the cache
uses: actions/cache/restore@v4
with:
fail-on-cache-miss: true
key: ${{ github.run_id}}-${{ matrix.builder }}
path: images.tar.zst
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
- name: Load Docker images into the Docker daemon
run: zstd -dc --long=31 images.tar.zst | docker load
- name: Log into Docker Hub
if: matrix.tag_public != ''
run: echo '${{ secrets.DOCKER_HUB_TOKEN }}' | docker login -u '${{ secrets.DOCKER_HUB_USER }}' --password-stdin
- name: Log into internal registry
if: matrix.tag_private != ''
run: |
REGISTRY_TOKEN=$(
curl -sSf --retry 3 --retry-delay 1 --retry-all-errors --connect-timeout 3 \
-X POST -d '{"username":"${{ secrets.SERVICE_TOKEN_USER_NAME }}", "password":"${{ secrets.SERVICE_TOKEN_PASSWORD }}"}' \
'${{ secrets.SERVICE_TOKEN_ENDPOINT }}' \
| jq --exit-status -r '.raw_id_token'
)
echo "${REGISTRY_TOKEN}" | docker login '${{ secrets.REGISTRY_HOST }}' -u '${{ secrets.REGISTRY_USER }}' --password-stdin
- name: Tag builder and push to Docker Hub
if: matrix.tag_public != ''
run: |
PUBLIC_IMAGE_URI='${{ matrix.tag_public }}'
set -x
docker tag '${{ matrix.builder }}' "${PUBLIC_IMAGE_URI}"
docker push "${PUBLIC_IMAGE_URI}"
- name: Tag builder and push to internal registry
if: matrix.tag_private != ''
run: |
PRIVATE_IMAGE_URI='${{ secrets.REGISTRY_HOST }}/s/${{ secrets.SERVICE_TOKEN_USER_NAME }}/${{ matrix.tag_private }}'
set -x
docker tag '${{ matrix.builder }}' "${PRIVATE_IMAGE_URI}"
docker push "${PRIVATE_IMAGE_URI}"
18 changes: 9 additions & 9 deletions builder-classic-22/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ version = "0.17.6"

[[buildpacks]]
id = "heroku/clojure"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/clojure?version=0.0.0&name=Heroku+Clojure+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/clojure?version=0.0.0&name=Heroku+Clojure+(Shimmed)"

[[buildpacks]]
id = "heroku/go"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/go?version=0.0.0&name=Heroku+Go+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/go?version=0.0.0&name=Heroku+Go+(Shimmed)"

[[buildpacks]]
id = "heroku/gradle"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/gradle?version=0.0.0&name=Heroku+Gradle+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/gradle?version=0.0.0&name=Heroku+Gradle+(Shimmed)"

[[buildpacks]]
id = "heroku/java"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/java?version=0.0.0&name=Heroku+Java+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/java?version=0.0.0&name=Heroku+Java+(Shimmed)"

[[buildpacks]]
id = "heroku/nodejs"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/nodejs?version=0.0.0&name=Heroku+Node.js+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/nodejs?version=0.0.0&name=Heroku+Node.js+(Shimmed)"

[[buildpacks]]
id = "heroku/php"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/php?version=0.0.0&name=Heroku+PHP+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/php?version=0.0.0&name=Heroku+PHP+(Shimmed)"

# We have to use Procfile CNB v2.0.2 in this builder image, since cnb-shim isn't compatible with
# the direct process mode used in newer Procfile CNB:
Expand All @@ -48,15 +48,15 @@ version = "0.17.6"

[[buildpacks]]
id = "heroku/python"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/python?version=0.0.0&name=Heroku+Python+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/python?version=0.0.0&name=Heroku+Python+(Shimmed)"

[[buildpacks]]
id = "heroku/ruby"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/ruby?version=0.0.0&name=Heroku+Ruby+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/ruby?version=0.0.0&name=Heroku+Ruby+(Shimmed)"

[[buildpacks]]
id = "heroku/scala"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/scala?version=0.0.0&name=Heroku+Scala+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/scala?version=0.0.0&name=Heroku+Scala+(Shimmed)"

[[order]]
[[order.group]]
Expand Down
12 changes: 6 additions & 6 deletions buildpacks-20/builder.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ version = "0.17.6"

[[buildpacks]]
id = "heroku/go"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/go?version=0.0.0&name=Heroku+Go+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/go?version=0.0.0&name=Heroku+Go+(Shimmed)"

[[buildpacks]]
id = "heroku/gradle"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/gradle?version=0.0.0&name=Heroku+Gradle+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/gradle?version=0.0.0&name=Heroku+Gradle+(Shimmed)"

[[buildpacks]]
id = "heroku/java"
Expand All @@ -33,7 +33,7 @@ version = "0.17.6"

[[buildpacks]]
id = "heroku/php"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/php?version=0.0.0&name=Heroku+PHP+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/php?version=0.0.0&name=Heroku+PHP+(Shimmed)"

# We have to use Procfile CNB v2.0.2 in this builder image, since cnb-shim isn't compatible with
# the direct process mode used in newer Procfile CNB:
Expand All @@ -44,15 +44,15 @@ version = "0.17.6"

[[buildpacks]]
id = "heroku/python"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/python?version=0.0.0&name=Heroku+Python+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/python?version=0.0.0&name=Heroku+Python+(Shimmed)"

[[buildpacks]]
id = "heroku/ruby"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/ruby?version=0.0.0&name=Heroku+Ruby+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/ruby?version=0.0.0&name=Heroku+Ruby+(Shimmed)"

[[buildpacks]]
id = "heroku/scala"
uri = "https://cnb-shim.herokuapp.com/v1/heroku/scala?version=0.0.0&name=Heroku+Scala+(Shimmed)"
uri = "https://cnb-shim-schneems-tell--3uftbg.herokuapp.com/v1/heroku/scala?version=0.0.0&name=Heroku+Scala+(Shimmed)"

[[order]]
[[order.group]]
Expand Down

0 comments on commit a043c3e

Please sign in to comment.