Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
types: [opened, synchronize, reopened]
push:
branches:
- master
- master

jobs:
report:
Expand All @@ -15,7 +15,7 @@ jobs:
run: echo ${{ github.ref }}
- name: event_name
run: echo ${{ github.event_name }}
build:
build-test-deploy-release:
name: Build
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -45,12 +45,12 @@ jobs:
run: make image-all KUBEBUILDER_DIR=${KUBEBUILDER_DIR}
env:
KUBEBUILDER_ASSETS: ${{ env.KUBEBUILDER_DIR }}/bin
- name: hub login
if: (github.event_name == 'push' && endsWith(github.ref,'/master')) || (github.event_name == 'create' && startsWith(github.ref,'refs/tags/'))

# these next steps are used for merge to master (push the images)
# they really should be separate workflows or jobs, but github actions is awful about sharing between them, so it must be one job
- name: docker login
if: github.event_name == 'push' && endsWith(github.ref,'/master')
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: deploy # when merged into master, tag master and push - ideally, this would be a separate job, but you cannot share docker build cache between jobs
if: github.event_name == 'push' && endsWith(github.ref,'/master')
run: make cd CONFIRM=true BRANCH_NAME=master
- name: release # when based on a tag, tag master and push - ideally, this would be a separate job, but you cannot share docker build cache between jobs
if: github.event_name == 'create' && startsWith(github.ref,'refs/tags/')
run: make release CONFIRM=true
49 changes: 48 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# workflow to release assets as part of the release

on:
push:
tags:
Expand All @@ -6,8 +8,29 @@ on:
name: Upload Release Asset

jobs:
build:
readiness:
name: check for appropriate image
runs-on: ubuntu-latest
steps:
- name: Set version and imagename
id: get_version
run: |
echo ::set-env name=VERSION::${GITHUB_REF/refs\/tags\//}
echo ::set-env name=IMAGENAME::packethost/cluster-api-provider-packet
echo ::set-env name=COMMIT::${GITHUB_SHA}
- name: information
run: echo "checking for existence of image ${IMAGENAME}:${COMMIT}. If it does not exist, this will fail; wait for an earlier PR merge action to complete and re-run this job."
- name: docker login
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: check for docker image on hub
run: docker buildx imagetools inspect ${IMAGENAME}:${COMMIT}
- name: report
run: ready for release; the docker image ${IMAGENAME}:${COMMIT} is available

release:
name: Upload Release Asset
needs:
- readiness
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -74,3 +97,27 @@ jobs:
asset_path: out/release/infrastructure-packet/${{ env.VERSION }}/metadata.yaml
asset_name: metadata.yaml
asset_content_type: application/yaml

images:
runs-on: ubuntu-latest
needs:
- readiness
steps:
- name: docker login
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Set version and imagename
id: get_version
run: |
echo ::set-env name=VERSION::${GITHUB_REF/refs\/tags\//}
echo ::set-env name=IMAGENAME::packethost/cluster-api-provider-packet
echo ::set-env name=COMMIT::${GITHUB_SHA}
- name: get-image
run: docker image pull ${IMAGENAME}:${COMMIT}
- name: release-latest
run: |
docker tag ${IMAGENAME}:${COMMIT} ${IMAGENAME}:latest
docker push ${IMAGENAME}:latest
- name: release-semver
run: |
docker tag ${IMAGENAME}:${COMMIT} ${IMAGENAME}:${VERSION}
docker push ${IMAGENAME}:${VERSION}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: vendor test manager clusterctl run install deploy crds generate fmt vet run kubebuilder ci cd

GIT_VERSION ?= $(shell git log -1 --format="%h")
GIT_VERSION ?= $(shell git log -1 --format="%H")
RELEASE_TAG := $(shell git describe --abbrev=0 --tags ${TAG_COMMIT} 2>/dev/null || true)
RELEASE_VERSION ?= $(shell cat VERSION)

Expand Down