Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dev release workflow #6

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# CI/CD Workflows for Gloo Portal IDP Connect

This repository contains several GitHub Actions workflows to manage the continuous integration, development releases, and production releases of the Gloo Portal IDP Connect project.

## Workflows

### 1. `gloo-portal-idp-connect CI`

File: `ci-pr.yml`

This workflow is triggered on any push or pull request to the `main` branch, excluding changes to `.ci/` and markdown files.

**Jobs:**
- **style-check**: Runs Go style checks using `golangci-lint`.
- **go-unit-test**: Executes unit tests for the Go codebase after the style check passes.

This workflow ensures that code quality and correctness are maintained in the `main` branch by enforcing linting and running unit tests.

### 2. `Release`

File: `ci-release.yml`

This workflow is triggered when a release is published on GitHub.

**Jobs:**
- **style-check**: Runs Go style checks using `golangci-lint`.
- **docker-release**: Publishes a Docker image tagged with the release version.
- **release-helm**: Publishes the `gloo-portal-idp-connect` Helm chart using the release version.

This workflow automates the production release process, ensuring that the Docker image and Helm chart are built and published whenever a release is created.

### 3. `Dev Release`

File: `ci-release-dev.yaml`

This workflow is manually triggered through the GitHub Actions UI (`workflow_dispatch`).

**Jobs:**
- **set-version**: Generates a version based on the current branch and commit hash. Naming convention: `dev-$BRANCH-$HASH`.
- **docker-release**: Publishes a Docker image tagged with the generated dev version.
- **release-helm**: Publishes the `gloo-portal-idp-connect` Helm chart tagged with the dev version.

This workflow helps during development, by allowing us to build and publish dev images as-needed, instead of needing to do a release or manual creation.
The only caveat is that it is published alongside the release images, and don't automatically get cleaned up.

## Future Improvements

- **Automated Cleanup**: We should add scheduled workflows or something to automatically clean up old dev released images and Helm charts to manage storage and maintain a clean registry.
- This could be as easy as having a weekly workflow that removes anything with the `dev-` prefix that is older than a certain date for images and charts.
- **Updated repositories**: Currently the repositories where we publish reference `gloo-mesh`, but should be updated to `gloo-ee` as this is part of the Gloo Gateway product.
- **D.R.Y.**: There is some duplication in the release workflows (dev + official) that could be refactored into a shared workflow to reduce maintenance overhead. Similar to how the CI workflows run in our [solo-io/solo-projects](https://github.com/solo-io/solo-projects/tree/4efea67fb02f573d2f3d7fcfdf584e7c55e752f6/.github/workflows) repo.
63 changes: 63 additions & 0 deletions .github/workflows/ci-release-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Dev Release
run-name: Dev release for branch ${{ github.ref_name }}

on:
workflow_dispatch:

jobs:
set-version: # Get version as first job to re-use the value without needing to re-calculate it.
name: Set Version for Dev Release
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
version: ${{ steps.set_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: set_version
run: |
BRANCH=$(echo $(git rev-parse --abbrev-ref HEAD) | tr -d '0123456789/.')
VERSION=dev-$BRANCH-$(git rev-parse --short HEAD)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Set version to $VERSION"
docker-release:
runs-on: ubuntu-latest
needs: [set-version]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Gcloud Login
uses: google-github-actions/setup-gcloud@a48b55b3b0eeaf77b6e1384aab737fbefe2085ac
with:
version: '386.0.0'
project_id: gloo-mesh
service_account_key: ${{ secrets.ARTIFACT_PUSHER_JSON_KEY }}
export_default_credentials: true
- name: Publish Docker image
env:
TAGGED_VERSION: ${{ needs.set-version.outputs.version }}
PROJECT: gloo-mesh
run: |
make docker-release
release-helm:
name: Release gloo-portal-idp-connect helm chart
needs: [set-version]
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
- name: Gcloud Login
uses: google-github-actions/setup-gcloud@a48b55b3b0eeaf77b6e1384aab737fbefe2085ac
with:
version: '386.0.0'
project_id: gloo-mesh
service_account_key: ${{ secrets.GLOO_RELEASE_ADMIN }}
export_default_credentials: true
- name: Publish Helm
env:
TAGGED_VERSION: ${{ needs.set-version.outputs.version }}
run: |
make publish-chart
Loading