Skip to content

Commit

Permalink
Merge pull request #79 from paketo-buildpacks/update-pipelines
Browse files Browse the repository at this point in the history
Update Pipelines Workflow

Signed-off-by: Ben Hale <bhale@vmware.com>
  • Loading branch information
nebhale authored Nov 1, 2020
2 parents 312f84a + ea0d7f0 commit 4cceecd
Show file tree
Hide file tree
Showing 42 changed files with 241 additions and 907 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
path: ../

codeowners:
- path: "*"
owner: "@paketo-buildpacks/java-buildpacks"
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/update-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Update Pipeline
"on":
schedule:
- cron: 0 5 * * 1-5
workflow_dispatch: {}
jobs:
update:
name: Update Pipeline
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.15"
- name: Install octo
run: |
#!/usr/bin/env bash
set -euo pipefail
GO111MODULE=on go get -u -ldflags="-s -w" github.com/paketo-buildpacks/pipeline-builder/cmd/octo
- id: pipeline
name: Update Pipeline
run: |
#!/usr/bin/env bash
set -euo pipefail
if [[ -f .github/pipeline-version ]]; then
OLD_VERSION=$(cat .github/pipeline-version)
else
OLD_VERSION="0.0.0"
fi
octo --descriptor "${DESCRIPTOR}"
PAYLOAD=$(gh api /repos/paketo-buildpacks/pipeline-builder/releases/latest)
NEW_VERSION=$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.name')
echo "${NEW_VERSION}" > .github/pipeline-version
RELEASE_NOTES=$(
gh api \
-F text="$(jq -n -r --argjson PAYLOAD "${PAYLOAD}" '$PAYLOAD.body')" \
-F mode="gfm" \
-F context="paketo-buildpacks/pipeline-builder" \
-X POST /markdown
)
git add .github/
git checkout -- .
echo "::set-output name=old-version::${OLD_VERSION}"
echo "::set-output name=new-version::${NEW_VERSION}"
echo "::set-output name=release-notes::${RELEASE_NOTES//$'\n'/%0A}"
env:
DESCRIPTOR: .github/pipeline-descriptor.yml
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: peter-evans/create-pull-request@v3
with:
body: |-
Bumps pipeline from `${{ steps.pipeline.outputs.old-version }}` to `${{ steps.pipeline.outputs.new-version }}`.
<details>
<summary>Release Notes</summary>
${{ steps.pipeline.outputs.release-notes }}
</details>
branch: update/pipeline
commit-message: |-
Bump pipeline from ${{ steps.pipeline.outputs.old-version }} to ${{ steps.pipeline.outputs.new-version }}
Bumps pipeline from ${{ steps.pipeline.outputs.old-version }} to ${{ steps.pipeline.outputs.new-version }}.
delete-branch: true
labels: semver:patch, type:task
signoff: true
title: Bump pipeline from ${{ steps.pipeline.outputs.old-version }} to ${{ steps.pipeline.outputs.new-version }}
token: ${{ secrets.GITHUB_TOKEN }}
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ Octo Pipelines is a CLI that generates a collection of GitHub Workflows and othe
The command line can either be built or run directly using Go.

```shell
$: go run github.com/paketo-buildpacks/pipeline-builder/octo/cmd --descriptor <DESCRIPTOR>
$: go run github.com/paketo-buildpacks/pipeline-builder/cmd/octo --descriptor <DESCRIPTOR>
```

The input is a YAML-based descriptor, examples of which can be found in [`descriptors/`](descriptors/).
The input is a YAML-based descriptor, examples of which can be found in `.github/pipeline-descriptor.yml` in other repositories.

### Common Workflows
Regardless of the contents of the descriptor a minimal set of workflows and artifacts are created.
Regardless of the contents of the descriptor the pipeline builder creates a minimal set of workflows and artifacts.

#### Dependendabot
* [Example `dependabot.yml`](https://github.com/paketo-buildpacks/adopt-openjdk/blob/main/.github/dependabot.yml)
Expand All @@ -27,7 +27,12 @@ A [Dependendabot configuration file](https://docs.github.com/en/free-pro-team@la
* [Example `synchronize-labels.yml`](https://github.com/paketo-buildpacks/adopt-openjdk/blob/main/.github/workflows/synchronize-labels.yml)
* [Example `minimal-labels.yml`](https://github.com/paketo-buildpacks/adopt-openjdk/blob/main/.github/workflows/minimal-labels.yml)

In order to facilitate the automated creation of draft releases and notes, a set of semver-scope labels (`semver:major`, `semver:minor`, and `semver:patch`) and type labels (`type:bug`, `type:dependency-upgrade`, `type:documentation`, `type:enhancement`, `type:question`, `type:task`) are added to the repository. In addition a workflow that enforces exactly one of each label is attached to every PR.
In order to facilitate the automated creation of draft releases and notes, a set of semver-scope labels (`semver:major`, `semver:minor`, and `semver:patch`) and type labels (`type:bug`, `type:dependency-upgrade`, `type:documentation`, `type:enhancement`, `type:question`, `type:task`) are added to the repository. In addition, a workflow that enforces exactly one of each label is attached to every PR.

#### Pipeline Updater
* [Example `update-pipelines.yml`](https://github.com/paketo-buildpacks/adopt-openjdk/blob/main/.github/workflows/update-pipelines.yml)

A pipeline-updating workflow is added to the repository to ensure that workflows are kept up to date as the `pipeline-builder` evolves.

#### Release Drafter
* [Example Release Notes](https://github.com/paketo-buildpacks/adopt-openjdk/releases/tag/v4.1.0)
Expand All @@ -37,15 +42,14 @@ In order to facilitate the automated creation of draft releases and notes, a set
Draft release notes are created on every commit to `main`. These notes take into account every PR since the previous release in order to create a division of the types of changes that were made and the semver scope of the change to work out the next release number.

### Descriptor
The descriptor is a YAML document with a number of top-level keys that correspond to new workflows, modified workflows, or artifacts.

The descriptor is a YAML document with a number of top-level keys that correspond to new workflows, modified workflows, or artifacts. All top-level keys are optional.

#### `path` (required)
#### `path`
```yaml
path: ../../adopt-openjdk
path: ..
```
`path` is a pointer to a Git repository, on your local filesystem, where files will be created.
`path` is a pointer to a Git repository, on your local filesystem, where files will be created. If unspecified, the default is `..`.

#### `codeowners` (optional)
```yaml
Expand All @@ -70,7 +74,7 @@ package:
* [Example `create-package.yml`](https://github.com/paketo-buildpacks/adopt-openjdk/blob/main/.github/workflows/create-package.yml)
* [Example `test.yml`](https://github.com/paketo-buildpacks/adopt-openjdk/blob/main/.github/workflows/tests.yml)

`package` is an object that describes the `repository` a buildpackage should be published to as well as whether to include the buildpackage's dependencies when creating it (`false` by default). If defined, a `create-package` workflow is created that creates and publishes a new package when a release is published as well as adds a `create-package` job to the tests workflow that is run on each PR and each commit. It will also add additional content to the draft release notes about the contents of the build package and will update the digest of the buildpackage in the published release notes. If `register` is `true`, after the a package is created, it is registered with the [Buildpack Registry Index](https://github.com/buildpacks/registry-index).
`package` is an object that describes the `repository` a buildpackage should be published to as well as whether to include the buildpackage's dependencies when creating it (`false` by default). If defined, a `create-package` workflow is created that creates and publishes a new package when a release is published as well as adds a `create-package` job to the tests workflow that is run on each PR and each commit. It will also add additional content to the draft release notes about the contents of the build package and will update the digest of the buildpackage in the published release notes. If `register` is `true`, after the package is created, it is registered with the [Buildpack Registry Index](https://github.com/buildpacks/registry-index).

#### `builder` (optional)
```yaml
Expand All @@ -81,7 +85,7 @@ builder:
* [Example `create-builder.yml`](https://github.com/projectriff/builder/blob/main/.github/workflows/create-builder.yml)
* [Example `test.yml`](https://github.com/projectriff/builder/blob/main/.github/workflows/tests.yml)

`builder` is an object that describes the `repository` a builder should be published to. If defined, a `create-builder` workflow is created thats creates and publishes a new builder when a release is published as well as adds a `create-builder` job to the tests workflow that is run on each PR and each commit. It will also add additional content to the draft release notes about the contents of the build package and will update the digest of the builder in the published release notes. Finally it will add update workflows for the lifecyle and builder image elements of the `builder.toml` file.
`builder` is an object that describes the `repository` a builder should be published to. If defined, a `create-builder` workflow is created that's creates and publishes a new builder when a release is published as well as adds a `create-builder` job to the tests workflow that is run on each PR and each commit. It will also add additional content to the draft release notes about the contents of the build package and will update the digest of the builder in the published release notes. Finally it will add update workflows for the lifecycle and builder image elements of the `builder.toml` file.

#### `docker_credentials` (optional)
```yaml
Expand Down Expand Up @@ -157,7 +161,7 @@ with:
```

### Amazon Corretto Dependency
The Amazon Corretto Dependency watches [Amazon Correto repositories](https://github.com/corretto/) for new versions.
The Amazon Corretto Dependency watches [Amazon Corretto repositories](https://github.com/corretto/) for new versions.

```yaml
uses: docker://ghcr.io/paketo-buildpacks/actions/amazon-corretto-dependency:main
Expand Down
File renamed without changes.
71 changes: 0 additions & 71 deletions descriptors/adopt-openjdk.yml

This file was deleted.

44 changes: 0 additions & 44 deletions descriptors/amazon-corretto.yml

This file was deleted.

53 changes: 0 additions & 53 deletions descriptors/apache-tomcat.yml

This file was deleted.

65 changes: 0 additions & 65 deletions descriptors/azul-zulu.yml

This file was deleted.

Loading

0 comments on commit 4cceecd

Please sign in to comment.