Skip to content

Commit

Permalink
onboard to oci-factory (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucabello authored Aug 17, 2023
1 parent b4c1c7d commit 85efc8c
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 57 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Pull Requests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- main

jobs:
pull-request:
name: PR
uses: canonical/observability/.github/workflows/rock-pull-request.yaml@main
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/rock-release-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Publish ROCK to GHCR:dev"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch: {}
push:
branches:
- main

jobs:
build:
uses: canonical/observability/.github/workflows/rock-release-dev.yaml@main
secrets: inherit
with:
rock-name: traefik
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build ROCK
name: Open a PR to OCI Factory

on:
workflow_dispatch: {}
Expand All @@ -8,7 +8,7 @@ on:

jobs:
build:
uses: canonical/observability/.github/workflows/build-rock.yaml@main
uses: canonical/observability/.github/workflows/rock-release-oci-factory.yaml@main
secrets: inherit
with:
rock-name: traefik
22 changes: 22 additions & 0 deletions .github/workflows/rock-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Update ROCK

on:
workflow_dispatch: {}
schedule:
- cron: '0 0,4,8,12,16,20 * * *'

jobs:
build:
uses: canonical/observability/.github/workflows/rock-update.yaml@main
with:
rock-name: traefik
source-repo: traefik/traefik
check-go: true
update-script: |
# The caller must provide \$application_src and \$rockcraft_yaml
# \$application_src: The root folder of the cloned upstream project
# \$rockcraft_yaml: Path of the rockcraft.yaml to update
#
## traefik-frontend dependency
source_tag=$(yq .parts.traefik.source-tag)
tag="\$source_tag" yq -i '.parts.traefik-frontend.source-tag = strenv(tag)'
25 changes: 0 additions & 25 deletions .github/workflows/test-rock.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/update-rock.yaml

This file was deleted.

File renamed without changes.
26 changes: 10 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
# traefik-rock

[![Build ROCK](https://github.com/canonical/traefik-rock/actions/workflows/build-rock.yaml/badge.svg)](https://github.com/canonical/traefik-rock/actions/workflows/build-rock.yaml)
[![Open a PR to OCI Factory](https://github.com/canonical/traefik-rock/actions/workflows/rock-release-oci-factory.yaml/badge.svg)](https://github.com/canonical/traefik-rock/actions/workflows/rock-release-oci-factory.yaml)
[![Publish to GHCR:dev](https://github.com/canonical/traefik-rock/actions/workflows/rock-release-dev.yaml/badge.svg)](https://github.com/canonical/traefik-rock/actions/workflows/rock-release-dev.yaml)
[![Update ROCK](https://github.com/canonical/traefik-rock/actions/workflows/rock-update.yaml/badge.svg)](https://github.com/canonical/traefik-rock/actions/workflows/rock-update.yaml)

Automation for building a ROCK for Traefik. Every fourth hour, the automation checks whether
a new release has been cut in the upstream Traefik repo, and if so, creates a pull request with
the new version info.
[ROCKs](https://canonical-rockcraft.readthedocs-hosted.com/en/latest/) for [Traefik](https://traefik.io/).
This repository holds all the necessary files to build ROCKs for the upstream versions we support. The Traefik ROCK is used by the [traefik-k8s-operator](https://github.com/canonical/traefik-k8s-operator) charm.

Once the PR gets merged, a new ROCK is built and published on ghcr.io/canonical/traefik.
The ROCKs on this repository are built with [OCI Factory](https://github.com/canonical/oci-factory/), which also takes care of periodically rebuilding the images.

Automation takes care of:
* validating PRs, by simply trying to build the ROCK;
* pulling upstream releases, creating a PR with the necessary files to be manually reviewed;
* releasing to GHCR at [ghcr.io/canonical/traefik:dev](https://ghcr.io/canonical/traefik:dev), when merging to main, for development purposes.

# Manual verification:
```
rockcraft -v
skopeo --insecure-policy copy oci-archive:traefik_2.9.6_amd64.rock docker-daemon:trfk
docker run --rm -p 8080:8080 trfk
```

cleanup:
`docker rmi -f trfk`

0 comments on commit 85efc8c

Please # to comment.