Skip to content

Commit eeef485

Browse files
authored
Merge pull request #135 from sp-yduck/improve/ci
support chat command for ci workflow
2 parents 137744f + ebc6935 commit eeef485

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ on:
44
push:
55
branches:
66
- main
7+
issue_comment:
8+
types: [created, edited]
79

810
env:
911
REGISTRY: docker.io
1012
IMAGE_NAME: spyduck/cluster-api-provider-proxmox
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1114

1215
jobs:
1316
# add public code coverage reports
1417
coverage:
1518
name: unit test coverage
1619
runs-on: ubuntu-latest
20+
if: github.event_name == "push" || contains(github.event.comment.body, "/unit-test")
1721
steps:
1822
- uses: actions/checkout@master
1923
- run: "make unit-test-cover"
@@ -23,6 +27,7 @@ jobs:
2327
build:
2428
name: docker build & push
2529
runs-on: ubuntu-latest
30+
if: github.event_name == "push" || contains(github.event.comment.body, "/buid-push")
2631
steps:
2732
- name: Checkout repository
2833
uses: actions/checkout@v4
@@ -33,5 +38,15 @@ jobs:
3338
username: ${{ secrets.DOCKER_USERNAME }}
3439
password: ${{ secrets.DOCKER_PASSWORD }}
3540

41+
# platform = linux/amd64,linux/arm64
3642
- name: Build and push Docker image
37-
run: "make docker-build docker-push IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_SHA::7}"
43+
run: "make docker-buildx IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_SHA::7}"
44+
45+
# report result to pr comment if event is pr comment
46+
result:
47+
name: report to pr comment
48+
runs-on: ubunt-latest
49+
if: github.event_name == "issue_comment" && ${{ github.event.issue.pull_request }}
50+
steps:
51+
- run: |
52+
gh pr comment ${{ github.event.issue.number }} -b "[Actions: CI] Check result [here](https://github.com/sp-yduck/cluster-api-provider-proxmox/actions/runs/${{ github.run_number }})"

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
143143
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
144144
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
145145
.PHONY: docker-build
146-
docker-build: # test ## Build docker image with the manager.
146+
docker-build: unit-test ## Build docker image with the manager.
147147
docker build -t ${IMG} .
148148

149149
.PHONY: docker-push
@@ -156,9 +156,9 @@ docker-push: ## Push docker image with the manager.
156156
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
157157
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> then the export will fail)
158158
# To properly provided solutions that supports more than one platform you should use this option.
159-
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
159+
PLATFORMS ?= linux/arm64,linux/amd64 #,linux/s390x,linux/ppc64le
160160
.PHONY: docker-buildx
161-
docker-buildx: test ## Build and push docker image for the manager for cross-platform support
161+
docker-buildx: ## Build and push docker image for the manager for cross-platform support
162162
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
163163
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
164164
- docker buildx create --name project-v3-builder

0 commit comments

Comments
 (0)