Compare commits

...

93 Commits
0.1.0 ... main

Author SHA1 Message Date
Juan Bustamante 2f19abaa19
Merge pull request #51 from buildpacks/update-version
Update default version of @orb.yml
2023-11-24 08:42:09 -05:00
Juan Bustamante 530701a74e
Merge branch 'main' into update-version
Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
2023-11-24 08:41:55 -05:00
Juan Bustamante a5f67de09e
Merge pull request #52 from AidanDelaney/trust-builder
Trust the build by default
2023-11-24 08:40:47 -05:00
Juan Bustamante 3155c35c0d
Merge pull request #53 from AidanDelaney/update-base-image
Update machine image and pack version
2023-11-24 08:40:10 -05:00
buildpack-bot a1b0f2d6a5 Update version to latest release of buildpacks/pack
Signed-off-by: GitHub <noreply@github.com>
2023-11-14 20:21:40 +00:00
Joe Kutner 5eb4f17c7c
Merge pull request #54 from edmorley/update-example-builder-image
Update examples to use a supported builder image
2023-10-16 18:33:19 -05:00
Ed Morley 619e3e2dd4
Update examples to use a supported builder image
The `heroku/buildpacks:18` builder image has been EOLed and aborts
with an error message.

The examples have been updated to use the newer `heroku/builder:22`.

For all available builder image variants, see:
https://github.com/heroku/cnb-builder-images/blob/main/README.md

Signed-off-by: Ed Morley <501702+edmorley@users.noreply.github.com>
2023-10-03 14:05:21 +01:00
Aidan Delaney f0578ebd4b Update machine image and pack version
Update to using a modern Ubuntu base image and use latest `pack`
version by default

Signed-off-by: Aidan Delaney <adelaney21@bloomberg.net>
2023-06-08 05:50:30 +01:00
Aidan Delaney 0cddf0d5d6 Trust the build by default
`pack` should trust the builder by default

Signed-off-by: Aidan Delaney <adelaney21@bloomberg.net>
2023-04-09 18:36:22 +01:00
Javier Romero 913be197c6
Merge pull request #48 from buildpacks/update-version
Update default version of @orb.yml
2022-06-03 16:30:32 -05:00
buildpack-bot cc391d52f9 Update version to latest release of buildpacks/pack
Signed-off-by: GitHub <noreply@github.com>
2022-05-06 13:37:34 +00:00
Javier Romero de7c5df218
Merge pull request #47 from buildpacks/update-version
Update default version of @orb.yml
2022-04-23 12:30:45 -05:00
buildpack-bot 8c2d84ba38 Update version to latest release of buildpacks/pack
Signed-off-by: GitHub <noreply@github.com>
2022-04-22 15:36:26 +00:00
Javier Romero 17d3f29875
Merge pull request #46 from edmorley/curl-retry-timeouts
Add retries, timeouts and status code checking to curl usages
2022-04-14 12:12:02 -05:00
Ed Morley fff3f220a2
Add retries, timeouts and status code checking to curl usages
To improve CI reliability in the case of transient network/GitHub/CDN issues.

Closes #45.

Signed-off-by: Ed Morley <501702+edmorley@users.noreply.github.com>
2022-04-08 20:10:43 +01:00
Javier Romero 46ec76538d
Merge pull request #44 from buildpacks/update-version
Update default version of @orb.yml
2022-04-06 11:11:04 -05:00
buildpack-bot 87dad6af6a Update version to latest release of buildpacks/pack
Signed-off-by: GitHub <noreply@github.com>
2022-04-02 18:22:50 +00:00
Javier Romero 2246e4a453
Merge pull request #42 from buildpacks/update-version
Update default version of @orb.yml
2022-02-14 14:19:52 -06:00
buildpack-bot 02c8c71447 Update version to latest release of buildpacks/pack
Signed-off-by: GitHub <noreply@github.com>
2022-02-10 18:28:29 +00:00
Javier Romero 3727a921a7
Merge pull request #41 from buildpacks/update-version
Update default version of @orb.yml
2021-11-08 11:21:50 -06:00
Javier Romero 7dd27675eb Fix yamllint error + add configuration
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-11-08 11:19:08 -06:00
buildpack-bot 7710ecaa6a Update version to latest release of buildpacks/pack
Signed-off-by: GitHub <noreply@github.com>
2021-11-08 17:07:49 +00:00
Javier Romero 50b35365e1
Merge pull request #38 from buildpacks/update-version
Update default version of @orb.yml
2021-10-20 08:57:57 -07:00
Javier Romero 0c86df4f76
Merge pull request #39 from importhuman/update-default-version
Add workflow_dispatch to allow manual trigger
2021-09-18 08:13:50 -05:00
Ujjwal Goyal a65fef7c5d Fix spacing in update-version.yml
Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
2021-09-18 18:23:36 +05:30
Ujjwal Goyal 47b249190b Add workflow_dispatch to allow manual trigger
Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
2021-09-18 18:19:13 +05:30
buildpack-bot 42e38e4e5d Update version to latest release of buildpacks/pack
Signed-off-by: GitHub <noreply@github.com>
2021-09-18 00:06:58 +00:00
Javier Romero d7368a57c9
Merge pull request #37 from importhuman/update-default-version
Fix update-version.yml, update pack in @orb.yml
2021-09-17 14:05:13 -05:00
Ujjwal Goyal 94eb5b3ab1 Fix update-version.yml, update pack in @orb.yml
Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
2021-09-17 17:22:00 +05:30
Javier Romero 7cfdb28c63
Merge pull request #36 from importhuman/update-default-version
Fix update-version.yml
2021-08-27 14:28:53 -05:00
Ujjwal Goyal 1bcabd71dd Fix update-version.yml
Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
2021-08-25 23:39:41 +05:30
Javier Romero 1b51d3b608
Merge pull request #35 from importhuman/update-default-version
Remove -f flag from sed script
2021-08-20 11:29:59 -05:00
Ujjwal Goyal 4bae602fd7 Remove -f flag from sed script
Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
2021-08-20 11:30:50 +05:30
Javier Romero 1952baeaa9
Merge pull request #34 from importhuman/update-default-version
Add workflow to update default pack version
2021-08-19 14:25:32 -05:00
Ujjwal Goyal bf300f4744 Add workflow to update default pack version
Signed-off-by: Ujjwal Goyal <importujjwal@gmail.com>
2021-08-19 22:36:36 +05:30
David Freilich ddeaa001d0
Merge pull request #33 from edmorley/update-default-pack
Update default Pack version from 0.18.1 to 0.20.0
2021-08-13 02:27:01 +03:00
Ed Morley 24def30fbd
Update default Pack version from 0.18.1 to 0.20.0
https://github.com/buildpacks/pack/releases/tag/v0.19.0
https://github.com/buildpacks/pack/releases/tag/v0.20.0
Signed-off-by: Ed Morley <501702+edmorley@users.noreply.github.com>
2021-08-02 11:46:09 +01:00
Javier Romero 1abdea7406
Merge pull request #32 from buildpacks/pack-tags
Add support for multiple tags and buildpacks declarations
2021-05-25 00:29:30 -05:00
Javier Romero cf44fd8451 Add support for multiple tags and buildpacks declarations
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-05-05 06:32:15 -05:00
Javier Romero f4b67a4f4f Make buildpack flag plural supporting multiple buildpacks
Also rearchitected to support testing.

Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-05-05 05:44:25 -05:00
Javier Romero 00c283d2da
Merge pull request #31 from buildpacks/unit-tests
Added unit tests for save-image-to-workspace command
2021-05-04 06:59:11 -05:00
Javier Romero dbc9e301eb CI: Update orb-tools version
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-05-04 06:52:57 -05:00
Javier Romero 11e6612ec6 CI: Use orb pack
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-05-04 06:50:58 -05:00
Javier Romero 8f8745e69d Merge branch 'release/0.2.3' into unit-tests 2021-05-04 06:47:27 -05:00
Javier Romero 9a13a52644 Add .editorconfig
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-05-04 06:42:41 -05:00
Javier Romero 0634d3a885 Added unit tests for save-image-to-workspace command
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-05-04 06:34:58 -05:00
Javier Romero 38e4a3e4e2 pack orb before publish
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-04-22 15:01:43 -05:00
Javier Romero 0a164a9430 Update GitHub token variable
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-04-22 13:49:44 -05:00
Javier Romero 2bff69bb56
Merge pull request #30 from buildpacks/feature/improve-release-process
Improve release process
2021-04-22 12:48:32 -05:00
Javier Romero 8e5a650de1 Move changelog generation to Makefile, add process documents
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-04-22 12:36:05 -05:00
Javier Romero c08b235e60
Merge pull request #29 from buildpacks/fix/28-log-output
Fix tty issue with output by removing 'color' functionality
2021-04-21 22:24:38 -05:00
Javier Romero eb052ac5e6 Fix tty issue with output by removing 'color' functionality
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-04-21 22:09:33 -05:00
Javier Romero a492cae142
Merge pull request #27 from buildpacks/feature/update-pack-default-version
Update default pack version to 0.18.1
2021-04-21 22:01:51 -05:00
Javier Romero a89a6750d5 Update default pack version to 0.18.1
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-04-21 21:55:53 -05:00
Javier Romero b56dd82931
Merge pull request #26 from buildpacks/feature/integration-tests
Add integrations tests
2021-04-21 21:52:28 -05:00
Javier Romero 8a521d8f94 wip
Signed-off-by: Javier Romero <rjavier@vmware.com>
2021-04-21 21:48:10 -05:00
Javier Romero a74ab17f87
Merge pull request #23 from genevieve/patch-1
Working dir can have a default empty for pwd
2021-04-19 12:59:23 -05:00
Genevieve 4c183ae43a
Working dir can have a default empty for pwd
Fixes #22

Signed-off-by: Genevieve L'Esperance <glesperance@doximity.com>
2021-04-19 08:39:04 -07:00
Javier Romero e380792cfd Remove VERSION file
Signed-off-by: Javier Romero <rjavier@vmware.com>
2020-12-18 10:10:05 -06:00
Javier Romero 7f27da12e0 Add changelog and release generation
Signed-off-by: Javier Romero <rjavier@vmware.com>
2020-12-18 10:02:34 -06:00
Javier Romero 3e5385680e Reset CODEOWNERS
Signed-off-by: Javier Romero <rjavier@vmware.com>
2020-12-17 09:52:07 -06:00
Javier Romero 53b4b70423
Merge pull request #20 from buildpacks/fix/19-report-toml
Set default executor and make it configurable
2020-12-16 10:28:06 -06:00
Javier Romero 1f2a08e726 Set default executor and make it configurable
Signed-off-by: Javier Romero <rjavier@vmware.com>
2020-12-16 09:52:45 -06:00
Javier Romero a5813dcb55
Merge pull request #16 from buildpacks/working_dir
allow user to specify the working directory/path
2020-12-08 13:26:02 -06:00
Javier Romero 36af9ad3a6
Merge pull request #18 from buildpacks/code-owner-elbandito
Add @elbandito as CODEOWNER
2020-11-09 21:07:09 -06:00
Javier Romero 604345bf68
Add @elbandito as CODEOWNER
Signed-off-by: Javier Romero <rjavier@vmware.com>
2020-11-09 15:25:36 -06:00
Travis 1dcd173f45 allow working-directory parameter for pack build path
Signed-off-by: Travis <longoria.public@gmail.com>
2020-10-21 10:58:32 -06:00
Travis Longoria c5a9c18116
feat: support --env flags (#15)
Signed-off-by: Travis <longoria.public@gmail.com>
2020-09-17 15:21:44 -06:00
Javier Romero f0a4c554a4
Merge pull request #14 from buildpacks/update_default_version
chore: set pack default to v0.13.1
2020-09-15 12:17:55 -05:00
Travis e80f3fb830 set default version on build job
Signed-off-by: Travis <longoria.public@gmail.com>
2020-09-14 13:47:58 -06:00
Travis Longoria e89b2af769
Merge branch 'main' into update_default_version 2020-09-14 13:15:32 -06:00
Travis 4fd8739bc4 chore: set pack default to v0.13.1
Signed-off-by: Travis <longoria.public@gmail.com>
2020-09-14 11:15:32 -06:00
Joe Kutner 8216bd855e
Merge pull request #11 from karuppiah7890/fix-undefined-parameter
Fix undefined parameter pack-version to version
2020-08-26 08:25:25 -05:00
Karuppiah Natarajan 7e20d05968
Fix undefined parameter pack-version to version
Signed-off-by: Karuppiah Natarajan <karuppiah7890@gmail.com>
2020-08-23 00:11:31 +05:30
Joe Kutner 1bddd9c655
Merge pull request #9 from buildpacks/update-versions
Update versions
2020-06-23 10:46:58 -05:00
Joe Kutner 0940b3b07f
Add pack-version as job param
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
2020-06-22 07:37:49 -05:00
Joe Kutner ff4e62b45b
Update versions of pack, docker, and orb-tools
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
2020-06-22 07:37:28 -05:00
Javier Romero 0c2a2ceeef
Merge pull request #8 from buildpacks/release-docs
Update readme
2020-05-12 21:28:59 -05:00
Joe Kutner c35ac7a518
Update readme
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
2020-05-12 12:39:51 -05:00
Javier Romero f5466ae692
Merge pull request #7 from buildpacks/pack-0.10.0
Upgrade default pack version to 0.10.0
2020-05-11 10:45:02 -05:00
Joe Kutner 9dbbb19ae7
Upgrade default pack version to 0.10.0
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
2020-05-06 07:39:30 -05:00
Javier Romero e27b3f1e2a
Merge pull request #5 from buildpacks/elbandito/update-dev-orb
chore: update to latest circleci tools orb
2020-04-20 17:41:12 -05:00
Travis 39a076c8c7 chore: update to latest dev orb
Signed-off-by: Travis <longoria.public@gmail.com>
2020-04-20 10:19:29 -06:00
Javier Romero 2d49f27191
Merge pull request #4 from jabrown85/patch-1
Give CircleCI user access to docker volumes
2020-04-11 20:11:22 -05:00
Jesse Brown 05b0ccb6c4 Give CircleCI user access to docker volumes
In order to cache the volumes created by pack, the `circleci` user needs to be able to see them. Without this, we end up storing a few bytes of data and thus never getting the cache from the previous builds.

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
2020-04-08 15:59:59 -05:00
E Casey a49c627ef7
Merge pull request #1 from eddiewebb/patch-1
Add source and home urls to orb source
2020-03-24 17:32:32 -04:00
E Casey f6c43c73fd
Merge pull request #2 from buildpacks/jromero-patch-1
Fix documentation link
2020-03-24 17:30:34 -04:00
E Casey 5f4b9210c5
Merge pull request #3 from buildpacks/jromero-patch-2
Create CODEOWNERS
2020-03-24 17:29:50 -04:00
Javier Romero 2f4bd6d651
Create CODEOWNERS
Signed-off-by: Javier Romero <rjavier@vmware.com>
2020-03-13 12:07:18 -05:00
Javier Romero 4fcd5ab9f6
Fix documentation link
Signed-off-by: Javier Romero <rjavier@vmware.com>
2020-03-11 09:41:07 -05:00
Eddie Webb 81a2ab5267 Remove extra space
Signed-off-by: Eddie Webb <ollitech@gmail.com>
2020-03-11 10:10:13 -04:00
Eddie Webb 7a463d770b Add source and home urls to orb source
This will include these links in the orb registry allowing users to get more info about the orb, or contribute to source!

Signed-off-by: Eddie Webb <ollitech@gmail.com>
2020-03-11 10:10:13 -04:00
Joe Kutner 319ad66fe6
Update examples to use correct orb name
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
2020-03-10 10:02:25 -05:00
24 changed files with 2093 additions and 158 deletions

View File

@ -1,36 +1,154 @@
version: 2.1
orbs:
orb-tools: circleci/orb-tools@9.0.0
# Orb depedencies
orbs:
orb-tools: circleci/orb-tools@10.0.3
## used for integration tests
buildpacks: buildpacks/pack@<<pipeline.parameters.dev-orb-version>>
# Pipeline Parameters
parameters:
## internal to orb-tools
run-integration-tests:
description: An internal flag to prevent integration test from running before a development version has been created.
type: boolean
default: false
## internal to orb-tools
dev-orb-version:
description: >
The development version of the orb to test.
This value is automatically adjusted by the "trigger-integration-tests-workflow" job to correspond with the specific version created by the commit and should not be edited.
A "dev:alpha" version must exist for the initial pipeline run.
type: string
default: "dev:alpha"
# Jobs to use in workflows
jobs:
test:
machine:
image: ubuntu-2204:2023.04.2
steps:
- checkout
- run:
name: Run unit tests
command: make test
github-release:
machine:
image: ubuntu-2204:2023.04.2
steps:
- run:
name: Install releaser
command: go get -u github.com/tcnksm/ghr
- checkout
- run:
name: Determine version
command: |
BRANCH=$CIRCLE_BRANCH make future-version | tail -1 > VERSION
cat VERSION
- run:
name: Generate changelog
command: |
VERSION=$(cat VERSION) make generate-changelog
- run:
name: Create GH release
command: |
VERSION=$(cat VERSION)
ghr -draft -t $GITHUB_TOKEN -c $CIRCLE_SHA1 -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME -b "$(cat CHANGELOG.md)" -n "pack-orb ${VERSION}" $VERSION
# Workflows
#
# The following is a visual representation of the existing workflows for development and releasing:
#
# on main branch and per PR on release/* branch
# ┌────────────────────────────┐ ┌─────────────────┐
# │ │ │ │
# │ ┌────────────┐ │ │ draft release │
# │ │ │ │ │ │
# │ │ validate │ │ └─────────────────┘
# │ │ │ │
# │ └──────┬─────┘ │
# │ │ *trigger* │
# │ │ │ on tags
# │ ┌───────▼───────┐ │ ┌────────────┐
# │ │ │ │ │ │
# │ │ integration │ │ │ publish │
# │ │ tests │ │ │ │
# │ │ │ │ └────────────┘
# │ └───────────────┘ │
# │ │
# └────────────────────────────┘
#
workflows:
validate-publish-dev:
integration-test:
when: << pipeline.parameters.run-integration-tests >>
jobs:
- buildpacks/build:
name: "Minimal"
builder: cnbs/sample-builder:bionic
image-name: test-image
working-directory: samples/apps/ruby-bundler
after-checkout:
- run: git clone --depth=1 https://github.com/buildpacks/samples.git samples
- buildpacks/build:
name: "All Options"
builder: cnbs/sample-builder:bionic
image-name: test-image
working-directory: samples/apps/ruby-bundler
buildpacks: samples/ruby-bundler
env-vars: "ENV_1=VAL 1;ENV_2=VAL 2"
tags: "another-image:2"
image-file: "exported-image.tgz"
version: "0.18.1"
after-checkout:
- run: git clone --depth=1 https://github.com/buildpacks/samples.git samples
validate-dev:
unless: << pipeline.parameters.run-integration-tests >>
jobs:
- orb-tools/lint
- test
- orb-tools/pack:
use-orb-pack: true
- orb-tools/publish-dev:
orb-name: buildpacks/pack
orb-path: orb.yml
publish-token-variable: CIRCLE_TOKEN
checkout: true
requires:
- orb-tools/lint
tag-triggered-publish:
- orb-tools/pack
- orb-tools/trigger-integration-tests-workflow:
name: trigger-integration-dev
requires:
- orb-tools/publish-dev
draft-release:
unless: << pipeline.parameters.run-integration-tests >>
jobs:
- hold-for-approval:
filters:
branches:
only: /release\/.*/
type: approval
- github-release:
filters:
branches:
only: /release\/.*/
requires:
- hold-for-approval
publish:
unless: << pipeline.parameters.run-integration-tests >>
jobs:
- orb-tools/pack:
use-orb-pack: true
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/
type: approval
- orb-tools/publish:
orb-ref: buildpacks/pack@$CIRCLE_TAG
orb-path: orb.yml
publish-token-variable: CIRCLE_TOKEN
attach-workspace: true
checkout: false
filters:
branches:
ignore: /.*/
tags:
only: /^\d+\.\d+\.\d+$/
requires:
- hold-for-approval
- orb-tools/pack

8
.editorconfig Normal file
View File

@ -0,0 +1,8 @@
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
[Makefile]
indent_style = tab

27
.github/workflows/update-version.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: update-pack-version
on:
repository_dispatch:
types:
- pack-release
workflow_dispatch:
jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update pack version of buildpacks/pack-orb/src/@orb.yml on new pack release
run: |
NEW_VERSION=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/buildpacks/pack/releases/latest | jq .tag_name -r | cut -c 2-)
sed -i 's/default: [0-9]\{1,\}.[0-9]\{1,\}.[0-9]\{1,\}/default: '"${NEW_VERSION}"'/g' src/@orb.yml
- name: Create pull request
uses: peter-evans/create-pull-request@v3.10.0
with:
token: ${{ secrets.DISTRIBUTION_GITHUB_TOKEN }}
commit-message: Update version to latest release of buildpacks/pack
title: Update default version of @orb.yml
body: Updates default version of @orb.yml to reflect release changes in buildpacks/pack
branch: update-version
base: main
signoff: true

View File

@ -0,0 +1,18 @@
## Filtering
unreleased-only=true
issues=false
## Other Visuals
compare-link=false
usernames-as-github-logins=true
## Sections
header-label=## Changelog
enhancement-label=### Improvements
enhancement-labels=type/enhancement
bugs-label=### Fixes
bug-labels=type/bug
pr-label=### Other Changes

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
# generated during release workflow
CHANGELOG.md
VERSION

6
.yamllint Normal file
View File

@ -0,0 +1,6 @@
extends: relaxed
rules:
line-length:
max: 200
allow-non-breakable-inline-mappings: true

1
CODEOWNERS Normal file
View File

@ -0,0 +1 @@
* @buildpacks/platform-maintainers

31
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,31 @@
We're glad you are interested in contributing to this project. We hope that this
document helps you get started.
## Policies
This repository adheres to the following project policies:
- [Code of Conduct][code-of-conduct] - How we should act with each other.
- [Contributing][contributing] - General contributing standards.
- [Security][security] - Reporting security concerns.
- [Support][support] - Getting support.
[code-of-conduct]: https://github.com/buildpacks/.github/blob/main/CODE_OF_CONDUCT.md
[contributing]: https://github.com/buildpacks/.github/blob/main/CONTRIBUTING.md
[security]: https://github.com/buildpacks/.github/blob/main/SECURITY.md
[support]: https://github.com/buildpacks/.github/blob/main/SUPPORT.md
## Contributing to this repository
### Development
Aside from the policies above, you may find [DEVELOPMENT.md](DEVELOPMENT.md) to provide specific helpful detail
to assist you while developing in this repository.
#### Creating a Pull Request
After making all the changes read the following [Pull Request process][pull-request-process].
[pull-request-process]: https://github.com/buildpacks/.github/blob/main/CONTRIBUTING.md#pull-request-process

23
DEVELOPMENT.md Normal file
View File

@ -0,0 +1,23 @@
## Prerequisites
* [Docker](https://www.docker.com/products/docker-desktop)
* [`circleci` CLI](https://circleci.com/docs/2.0/local-cli/#installation)
* Make (and build tools)
* macOS: `xcode-select --install`
* Windows:
* `choco install cygwin make -y`
* `[Environment]::SetEnvironmentVariable("PATH", "C:\tools\cygwin\bin;$ENV:PATH", "MACHINE")`
### Linting
```
make lint
```
### Testing
Tests are structured as recommended by the [Orb Project Template](https://github.com/CircleCI-Public/Orb-Project-Template/tree/master/src/tests). They use [shunit2](https://github.com/kward/shunit2) instead of [BATS-Core](https://github.com/bats-core/bats-core).
```
make test
```

46
Makefile Normal file
View File

@ -0,0 +1,46 @@
BRANCH?=$(shell git branch --show-current)
VERSION?=$(shell echo $(BRANCH) | grep "^release" | sed 's;release\/\(.*\);\1;')
.PHONY: publish-dev
publish-dev:
@echo "> Publishing new dev:alpha version..."
circleci orb pack src/ | circleci orb publish - buildpacks/pack@dev:alpha
.PHONY: lint
lint:
@echo "NOTE: If changes have been make to .circleci/config.yml "\
"that depend on changes to the orb. It may require for the 'dev:alpha' "\
"version to be updated.\n\nYou may run 'publish-dev' to do so (if permissions allow).\n"
@echo "> Validating orb..."
circleci orb pack src/ | circleci orb validate -
@echo "> Validating CI config..."
circleci config validate .circleci/config.yml
.PHONE: test
test:
@echo "> Running tests..."
cd ./src/tests/; find . -type f -name "*_test.sh" -exec {} \;
.PHONY: future-version
future-version:
@echo "> Determining future version..."
@$(if $(strip $(VERSION)),echo $(VERSION), echo "Failed to determine future version. May need to provide VERSION env var."; exit 1)
.PHONY: generate-changelog
generate-changelog: export TMP_DIR:=$(shell mktemp -d "/tmp/changelog.XXXXXXXXX")
generate-changelog: future-version
generate-changelog:
@echo "> Configuring changelog generator..."
@cp .github_changelog_generator $(TMP_DIR)
@echo "> Generating changelog..."
@docker run -it --rm -v "$(TMP_DIR)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator --user buildpacks --project pack-orb --token $(GITHUB_TOKEN) --future-release $(VERSION) -o CHANGELOG.md
@echo "> Cleaning it up..."
@# removes footer
@awk 'n>=3 { print a[n%3] } { a[n++%3]=$$0 }' "$(TMP_DIR)/CHANGELOG.md" > CHANGELOG.md
@echo "> CHANGELOG:"
@cat CHANGELOG.md

View File

@ -4,4 +4,16 @@
This is a [CircleCI Orb](https://circleci.com/orbs/) for using [Cloud Native Buildpacks](https://buildpacks.io) in your CircleCI jobs and workflows.
For more information and usage examples, see the [CircleCI documentation](https://circleci.com/orbs/registry/orb/buildpacks/pack-orb).
For more information and usage examples, see the [CircleCI documentation](https://circleci.com/orbs/registry/orb/buildpacks/pack).
## Usage
See the [documentation on the CircleCI Orb Registry](https://circleci.com/orbs/registry/orb/buildpacks/pack).
## Contributing
We ❤ contributions.
- [CONTRIBUTING](CONTRIBUTING.md) - Information on how to contribute, including the pull request process.
- [DEVELOPMENT](DEVELOPMENT.md) - Further detail to help you during the development process.
- [RELEASE](RELEASE.md) - Further details about our release process.

19
RELEASE.md Normal file
View File

@ -0,0 +1,19 @@
## Release Process
1. Create and push `release/<VERSION>` branch off of `main`.
1. After all [CI checks](https://app.circleci.com/pipelines/github/buildpacks/pack-orb) pass, find the job "hold-for-approval" and `Approve`.
1. On the [GitHub releases page](https://github.com/buildpacks/pack-orb/releases):
1. Click `Edit` on the latest _draft_ release.
1. Review (and edit) generated changelog.
1. Verify the _tag version_ value:
- It should be `<VERSION>`.
- It should "target" the `release/<VERSION>` branch.
1. Click `Publish` release.
_The release "Publish" action will create a tag that then triggers a workflow that additionally publishes the orb to the circleci catalog._
1. Confirm that the orb is updated by viewing the [orb page](https://circleci.com/developer/orbs/orb/buildpacks/pack).
## Makefile targets
`make future-version` - logic to determine the next version by looking at the current git branch.
`make generate-changelog` - process of generating the changelog for the `future-version`.

145
orb.yml
View File

@ -1,145 +0,0 @@
version: 2.1
description: Cloud Native Buildpacks Orb
orbs:
docker: circleci/docker@0.5.18
orb-tools: circleci/orb-tools@8.8.0
jobs:
build:
description: "Build OCI Image"
machine: true
parameters:
image-name:
type: string
image-file:
type: string
default: "image.tgz"
builder:
type: string
buildpack:
type: string
default: ""
steps:
- install-pack
- checkout
- pack-build:
image-name: << parameters.image-name >>
builder: << parameters.builder >>
buildpack: << parameters.buildpack >>
- save-image-to-workspace:
image-name: << parameters.image-name >>
image-file: << parameters.image-file >>
commands:
save-image-to-workspace:
description: "Save image"
parameters:
image-name:
type: string
image-file:
type: string
default: image.tgz
steps:
- run:
name: Save image to workspace
command: |
mkdir -p images
docker save -o images/<< parameters.image-file >> << parameters.image-name >>
- persist_to_workspace:
root: .
paths:
- ./
pack-build:
description: "Run pack build"
parameters:
image-name:
type: string
builder:
type: string
buildpack:
type: string
steps:
- restore_cache:
key: pack-cache-<< parameters.image-name >>-<< parameters.builder >>-{{ arch }}
- run:
name: Run pack build
command: |
pack build << parameters.image-name >> --builder << parameters.builder >> $(if [ -n "<< parameters.buildpack >>" ]; then echo -n "--buildpack << parameters.buildpack >>"; else echo -n ""; fi)
- save_cache:
key: pack-cache-<< parameters.image-name >>-<< parameters.builder >>-{{ arch }}-{{ epoch }}
paths:
- /var/lib/docker/volumes/
install-pack:
description: "Setup and install pack"
parameters:
install-dir:
default: ~/bin
description: |
Directory in which to install Pack binary
type: string
version:
type: string
default: 0.8.1
steps:
- run:
name: "Setup and install pack"
command: |
mkdir -p << parameters.install-dir >>
curl -L "https://github.com/buildpack/pack/releases/download/v<< parameters.version >>/pack-v<< parameters.version >>-linux.tgz" | tar xzm -C << parameters.install-dir >>
export PATH="$PATH:<< parameters.install-dir >>"
mkdir -p ~/.docker/
if [ ! -f ~/.docker/config.json ]; then
echo "{}" > ~/.docker/config.json
fi
examples:
heroku:
description: Run the Heroku Buildpacks
usage:
version: 2.1
orbs:
buildpacks: buildpacks/pack-orb@x.y.z
workflows:
main:
jobs:
- buildpacks/build:
image-name: myimage
builder: heroku/buildpacks:18
use-buildpack:
description: Run the Heroku Buildpacks
usage:
version: 2.1
orbs:
buildpacks: buildpacks/pack-orb@x.y.z
workflows:
main:
jobs:
- buildpacks/build:
image-name: myimage
builder: heroku/buildpacks:18
buildpack: heroku/ruby
build-and-publish:
description: Run the Heroku Buildpacks
usage:
version: 2.1
orbs:
buildpacks: buildpacks/pack-orb@x.y.z
jobs:
publish:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run:
command: |
docker load -i /tmp/workspace/images/myimage.tgz
docker push myimage
workflows:
main:
jobs:
- buildpacks/build:
image-name: myimage
image-file: myimage.tgz
builder: heroku/buildpacks:18
- publish:
requires:
- buildpacks/build

93
src/@orb.yml Normal file
View File

@ -0,0 +1,93 @@
version: 2.1
description: Cloud Native Buildpacks Orb
display:
source_url: "https://github.com/buildpacks/pack-orb"
home_url: "https://buildpacks.io/"
jobs:
build:
description: "Build OCI Image"
machine:
image: << parameters.executor-image >>
parameters:
builder:
type: string
description: Builder image name to use.
image-name:
type: string
description: Image name (aka tag) of the app image to be produced.
working-directory:
type: string
description: The directory where the app source is located.
default: ""
buildpacks:
type: string
description: The specific buildpacks to execute. Semicolon (;) delimited.
default: ""
env-vars:
type: string
description: Build-time environment variables. Semicolon (;) delimited.
default: ""
tags:
type: string
description: Additional image names to create. Semicolon (;) delimited.
default: ""
image-file:
type: string
description: Filename to save the app image as locally.
default: "image.tgz"
version:
type: string
description: Version of 'pack' to use.
default: 0.29.0
after-checkout:
description: Optional steps to run after checking out the code.
type: steps
default: []
executor-image:
type: string
description: Image to execute 'pack' in.
default: ubuntu-2204:2023.04.2
steps:
- run: sudo chown -R circleci /var/lib/docker/volumes
- install-pack:
version: << parameters.version >>
- checkout
- when:
name: Run after-checkout lifecycle hook steps.
condition: << parameters.after-checkout >>
steps: << parameters.after-checkout >>
- pack-build:
builder: << parameters.builder >>
image-name: << parameters.image-name >>
path: << parameters.working-directory >>
buildpacks: << parameters.buildpacks >>
env-vars: << parameters.env-vars >>
tags: << parameters.tags >>
- save-image-to-workspace:
image-name: << parameters.image-name >>
image-file: << parameters.image-file >>
commands:
install-pack:
description: "Setup and install pack"
parameters:
install-dir:
default: ~/bin
description: |
Directory in which to install Pack binary
type: string
version:
type: string
default: 0.29.0
steps:
- run:
name: "Setup and install pack"
command: |
mkdir -p << parameters.install-dir >>
curl -L --fail --retry 3 --connect-timeout 5 --max-time 60 "https://github.com/buildpack/pack/releases/download/v<< parameters.version >>/pack-v<< parameters.version >>-linux.tgz" | tar xzm -C << parameters.install-dir >>
export PATH="$PATH:<< parameters.install-dir >>"
mkdir -p ~/.docker/
if [ ! -f ~/.docker/config.json ]; then
echo "{}" > ~/.docker/config.json
fi

View File

@ -0,0 +1,41 @@
description: "Run pack build"
parameters:
builder:
type: string
description: The builder image name to use for building.
image-name:
type: string
description: The primary image name to save the image as.
path:
type: string
description: The path to the working directory to run `pack build` in.
default: ""
buildpacks:
type: string
description: The specific buildpacks to execute. Semicolon (;) delimited.
default: ""
env-vars:
type: string
description: Environment variables to set during the build. Semicolon (;) delimited.
default: ""
tags:
type: string
description: Additional image names to create. Semicolon (;) delimited.
default: ""
steps:
- restore_cache:
key: pack-cache-<< parameters.image-name >>-<< parameters.builder >>-{{ arch }}
- run:
name: Run pack build
environment:
PARAM_BUILDER: << parameters.builder >>
PARAM_IMAGE_NAME: << parameters.image-name >>
PARAM_PATH: << parameters.path >>
PARAM_BUILDPACKS: << parameters.buildpacks >>
PARAM_ENV_VARS: << parameters.env-vars >>
PARAM_TAGS: << parameters.tags >>
command: <<include(scripts/pack-build.sh)>>
- save_cache:
key: pack-cache-<< parameters.image-name >>-<< parameters.builder >>-{{ arch }}-{{ epoch }}
paths:
- /var/lib/docker/volumes/

View File

@ -0,0 +1,17 @@
description: "Save image to file"
parameters:
image-name:
type: string
image-file:
type: string
steps:
- run:
name: Save image to workspace
environment:
PARAM_IMAGE_NAME: << parameters.image-name >>
PARAM_IMAGE_FILE: << parameters.image-file >>
command: <<include(scripts/save-image-to-workspace.sh)>>
- persist_to_workspace:
root: .
paths:
- ./

12
src/examples/basic.yml Normal file
View File

@ -0,0 +1,12 @@
description: Basic usage
usage:
version: 2.1
orbs:
buildpacks: buildpacks/pack@x.y.z
workflows:
main:
jobs:
- buildpacks/build:
image-name: myimage
builder: heroku/builder:22

View File

@ -0,0 +1,26 @@
description: Build and publish
usage:
version: 2.1
orbs:
buildpacks: buildpacks/pack@x.y.z
workflows:
main:
jobs:
- buildpacks/build:
image-name: myimage
image-file: myimage.tgz
builder: heroku/builder:22
- publish:
requires:
- buildpacks/build
jobs:
publish:
machine: true
steps:
- attach_workspace:
at: /tmp/workspace
- run:
command: |
docker load -i /tmp/workspace/images/myimage.tgz
docker push myimage

View File

@ -0,0 +1,13 @@
description: Run specific buildpacks
usage:
version: 2.1
orbs:
buildpacks: buildpacks/pack@x.y.z
workflows:
main:
jobs:
- buildpacks/build:
image-name: myimage
builder: heroku/builder:22
buildpack: heroku/ruby

68
src/scripts/pack-build.sh Normal file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env bash
create_buildpack_flags() {
local flags=()
IFS=';' read -ra entries <<<"$1"
for entry in "${entries[@]}"; do
flags+=("--buildpack \"${entry}\"")
done
echo "${flags[@]}"
}
create_env_var_flags() {
local flags=()
IFS=';' read -ra entries <<<"$1"
for entry in "${entries[@]}"; do
IFS='=' read -ra parts <<<"$entry"
flags+=("--env ${parts[0]}=\"${parts[1]}\"")
done
echo "${flags[@]}"
}
create_path_flag() {
if [ -n "$1" ]; then
echo "--path \"$1\""
fi
}
create_tag_flags() {
local flags=()
IFS=';' read -ra entries <<<"$1"
for entry in "${entries[@]}"; do
flags+=("--tag \"${entry}\"")
done
echo "${flags[@]}"
}
create_command() {
for i in PARAM_BUILDER,builder PARAM_IMAGE_NAME,image-name; do
KEY=${i%,*}
VAL=${i#*,}
if [[ -z "${!KEY}" ]]; then
echo "param '${VAL}' is required!"
exit 1
fi
done
echo pack build \
--no-color \
--builder \"${PARAM_BUILDER}\" \
--trust-builder \
$(create_path_flag "${PARAM_PATH}") \
$(create_buildpack_flags "${PARAM_BUILDPACKS}") \
$(create_env_var_flags "${PARAM_ENV_VARS}") \
$(create_tag_flags "${PARAM_TAGS}") \
\"${PARAM_IMAGE_NAME}\"
}
main() {
eval $(create_command)
}
if [[ -n $(echo "$0" | sed 's/.*_test$//;s/.*_test\.sh$//') ]]; then
main "$@"
fi

View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
main() {
for i in PARAM_IMAGE_FILE,image-file PARAM_IMAGE_NAME,image-name; do
KEY=${i%,*}
VAL=${i#*,}
if [[ -z "${!KEY}" ]]; then
echo "param ${VAL} is required!"
exit 1
fi
done
local image_dir="${IMAGE_DIR:-images}"
echo "> Ensuring image dir '${image_dir}' exists..."
mkdir -p "$image_dir"
local full_image_path="${image_dir}/${PARAM_IMAGE_FILE}"
echo "> Exporting image '${PARAM_IMAGE_NAME}' as '${full_image_path}'..."
docker save -o "${full_image_path}" ${PARAM_IMAGE_NAME}
echo "> Saved as '${full_image_path}'..."
}
if [[ -n $(echo "$0" | sed 's/.*_test$//;s/.*_test\.sh$//') ]]; then
main "$@"
fi

86
src/tests/pack-build_test.sh Executable file
View File

@ -0,0 +1,86 @@
#!/usr/bin/env bash
testBuildpackFlagsWithNoValues() {
local values=""
local results=$(create_buildpack_flags "${values}") code="$?"
assertEquals 0 "$code"
assertEquals "$results" ""
}
testBuildpackFlagsWithValues() {
local values="my-buildpack@1.2.3;docker.io/org/other-buildpack:latest"
local results=$(create_buildpack_flags "${values}") code="$?"
assertEquals 0 "$code"
assertContains "$results" "--buildpack \"my-buildpack@1.2.3\""
assertContains "$results" "--buildpack \"docker.io/org/other-buildpack:latest\""
}
testEnvVarsFlagsWithNoValues() {
local values=""
local results=$(create_env_var_flags "${values}") code="$?"
assertEquals 0 "$code"
assertEquals "$results" ""
}
testEnvVarsFlagsWithValues() {
local values="ENV_1=VAL_1;ENV_2=VAL 2;"
local results=$(create_env_var_flags "${values}") code="$?"
assertEquals 0 "$code"
assertContains "$results" "--env ENV_1=\"VAL_1\""
assertContains "$results" "--env ENV_2=\"VAL 2\""
}
testPathFlagWithNoValue() {
local value=""
local results=$(create_path_flag "${value}") code="$?"
assertEquals 0 "$code"
assertEquals "$results" ""
}
testPathFlagWithValue() {
local value="some/nested/dir"
local results=$(create_path_flag "${value}") code="$?"
assertEquals 0 "$code"
assertContains "$results" "--path \"some/nested/dir\""
}
testTagFlagsWithNoValues() {
local values=""
local results=$(create_tag_flags "${values}") code="$?"
assertEquals 0 "$code"
assertEquals "$results" ""
}
testTagFlagsWithValues() {
local values="my-image;docker.io/org/image:2"
local results=$(create_tag_flags "${values}") code="$?"
assertEquals 0 "$code"
assertContains "$results" "--tag \"my-image\""
assertContains "$results" "--tag \"docker.io/org/image:2\""
}
testCreateCommandMissingBuilder() {
local results=$(create_command) code="$?"
assertEquals 1 "$code"
assertContains "$results" "param 'builder' is required!"
}
testCreateCommandMissingImageName() {
local results=$(PARAM_BUILDER=some-builder create_command) code="$?"
assertEquals 1 "$code"
assertContains "$results" "param 'image-name' is required!"
}
testCreateCommandFull() {
local results=$(PARAM_BUILDER=some-builder PARAM_IMAGE_NAME=some/image:latest PARAM_PATH=some/dir PARAM_BUILDPACKS=my-buildpack@1.2.3 PARAM_ENV_VARS="ENV_1=VAL_1" PARAM_TAGS="another/tag:2" create_command) code="$?"
assertEquals 0 "$code"
assertEquals 'pack build --no-color --builder "some-builder" --path "some/dir" --buildpack "my-buildpack@1.2.3" --env ENV_1="VAL_1" --tag "another/tag:2" "some/image:latest"' "$results"
}
oneTimeSetUp() {
echo "> Loading script under test..."
source './../scripts/pack-build.sh'
}
# Load shUnit2
. ./shunit2

View File

@ -0,0 +1,43 @@
#!/usr/bin/env bash
testParamImageFileRequired() {
local results="$(PARAM_IMAGE_NAME='name' main)" code="$?"
assertEquals 1 $code
assertContains "$results" "param image-file is required!"
}
testParamImageNameRequired() {
local results="$(PARAM_IMAGE_FILE='file' main)" code="$?"
assertEquals 1 $code
assertContains "$results" "param image-name is required!"
}
testImageFileIsCreated() {
cat <<EOF >${SHUNIT_TMPDIR}/Dockerfile
FROM busybox AS build-env
RUN touch /empty
FROM scratch
COPY --from=build-env /empty /.emptyfile
EOF
local image_name="test$RANDOM"
echo "> Creating docker image..."
docker build -t ${image_name} ${SHUNIT_TMPDIR}
local image_dir="${SHUNIT_TMPDIR}/images"
local results="$(IMAGE_DIR=$image_dir PARAM_IMAGE_NAME=$image_name PARAM_IMAGE_FILE='image.img' main)" code="$?"
assertEquals 0 $code
assertContains "$results" "$image_dir"
assertContains "$results" "$image_name"
ls -al $image_dir/image.img
}
oneTimeSetUp() {
echo "> Loading script under test..."
source './../scripts/save-image-to-workspace.sh'
}
# Load shUnit2
. ./shunit2

1343
src/tests/shunit2 Executable file

File diff suppressed because it is too large Load Diff