Merge pull request #1 from mesosphere/mh/cve-fixes #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- "master" | |
tags: | |
- "[0-9].[0-9]+.[0-9]+*" | |
pull_request: | |
branches: | |
- "master" | |
env: | |
CONTAINER_LABELS: | | |
org.opencontainers.artifact.description=Linkedin's Cruise Control (https://github.com/linkedin/cruise-control) | |
org.opencontainers.image.url=https://github.com/banzaicloud/docker-cruise-control | |
org.opencontainers.image.documentation=https://github.com/banzaicloud/docker-cruise-control | |
org.opencontainers.image.source=https://github.com/banzaicloud/docker-cruise-control | |
org.opencontainers.image.title=Linkedin's Cruise Control for Koperator | |
org.opencontainers.image.description=Linkedin's Cruise Control container image built for Koperator (https://github.com/banzaicloud/koperator) | |
org.opencontainers.image.vendor=Cisco Systems | |
PLATFORMS: linux/amd64 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
outputs: | |
cruise_control_version: ${{ steps.version.outputs.version }} | |
cruise_control_ui_version: ${{ steps.ui-version.outputs.version }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get Cruise Control version | |
id: version | |
run: make cruise-control-version >> "${GITHUB_OUTPUT}" | |
- name: Get Cruise Control UI version | |
id: ui-version | |
run: make cruise-control-ui-version >> "${GITHUB_OUTPUT}" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
flavor: | | |
latest=false | |
images: | | |
ghcr.io/mesosphere/cruise-control | |
tags: | | |
type=sha,enable=true,format=short,prefix= | |
labels: ${{ env.CONTAINER_LABELS }} | |
- name: Build Cruise Control container image | |
uses: docker/build-push-action@v4 | |
with: | |
build-args: | | |
CRUISE_CONTROL_VERSION=${{ steps.version.outputs.version }} | |
CRUISE_CONTROL_UI_GIT_REF=${{ steps.ui-version.outputs.version }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: ${{ env.PLATFORMS }} | |
push: false | |
load: true | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Run tests | |
run: make test | |
env: | |
CI: true | |
CRUISE_CONTROL_IMAGE: ${{ steps.meta.outputs.tags }} | |
READINESS_TIMEOUT: 3600 | |
publish: | |
if: ${{ github.event_name != 'pull_request' }} | |
needs: build | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
flavor: | | |
latest=auto | |
images: | | |
ghcr.io/banzaicloud/cruise-control | |
tags: | | |
type=semver,pattern={{version}} | |
type=edge,branch=master | |
labels: ${{ env.CONTAINER_LABELS }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Publish Cruise Control container image | |
uses: docker/build-push-action@v4 | |
with: | |
build-args: | | |
CRUISE_CONTROL_VERSION=${{ needs.build.outputs.cruise_control_version }} | |
CRUISE_CONTROL_UI_GIT_REF=${{ needs.build.outputs.cruise_control_ui_version }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: ${{ env.PLATFORMS }} | |
push: ${{ github.event_name != 'pull_request' }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |