Skip to content

Commit def8a60

Browse files
committed
Create Github action for Image build and push
1 parent ef10f5a commit def8a60

File tree

4 files changed

+27
-18
lines changed

4 files changed

+27
-18
lines changed

.github/workflows/mcad-release.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow will create a GitHub release tag
1+
# This workflow will Build image and push to mcad quay repository and create a GitHub release tag
22

33
name: mcad Release
44
on:
@@ -9,6 +9,11 @@ on:
99
required: true
1010
default: 'v0.0.0-dev'
1111
type: string
12+
quay-organization:
13+
description: 'Quay organization used to push the built images to'
14+
required: true
15+
default: 'project-codeflare'
16+
type: string
1217

1318
jobs:
1419
release:
@@ -20,6 +25,8 @@ jobs:
2025
steps:
2126
- name: checkout code
2227
uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
2330

2431
- name: check tag format
2532
run: |
@@ -41,3 +48,14 @@ jobs:
4148
env:
4249
GITHUB_TOKEN: ${{ github.token }}
4350

51+
- name: Build
52+
run: make mcad-controller
53+
54+
- name: Image Build and Push
55+
env:
56+
GIT_BRANCH: ${{ github.event.inputs.tag }}
57+
TAG: release-${{ github.event.inputs.tag }}
58+
run: |
59+
make images -e GIT_BRANCH=$GIT_BRANCH TAG=$TAG
60+
make push-images -e GIT_BRANCH=$GIT_BRANCH TAG=$TAG quay_repository=quay.io/${{ github.event.inputs.quay-organization }} quay_id=${{ secrets.QUAY_ID }} quay_token=${{ secrets.QUAY_TOKEN }}
61+

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ script:
2727
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make images; fi'
2828
# Process 'make images' when running as a pull request
2929
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then unset quay_repository && make images; fi'
30-
# Process 'make push-images' when NOT a pull request
31-
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make push-images; fi'
3230
# Run the e2e and handle Travis condition where Travis fails on no output for 10 minutes. No output for 10 minutes
3331
# is fine for our test cases that waits for 10 minutes before requeuing a job. The other workaround was to
3432
# use 'travis_wait n' which unfortunately does not stream output until the very end so monitoring the Travis log

Makefile

+5-10
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,11 @@ endif
1919

2020
# Check for current branch name and update 'RELEASE_VER' and 'TAG'
2121
ifneq ($(strip $(GIT_BRANCH)),)
22-
ifeq ($(shell echo $(GIT_BRANCH) | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$'),$(GIT_BRANCH))
23-
RELEASE_VER:=${GIT_BRANCH}
24-
TAG:=release-${TAG}
25-
else
26-
RELEASE_VER:= $(shell git describe --tags --abbrev=0)
27-
TAG:=${TAG}${GIT_BRANCH}
28-
# replace invalid characters that might exist in the branch name
29-
TAG:=$(shell echo ${TAG} | sed 's/[^a-zA-Z0-9]/-/g')
30-
TAG:=${TAG}-${RELEASE_VER}
31-
endif
22+
RELEASE_VER:= $(shell git describe --tags --abbrev=0)
23+
TAG:=${TAG}${GIT_BRANCH}
24+
# replace invalid characters that might exist in the branch name
25+
TAG:=$(shell echo ${TAG} | sed 's/[^a-zA-Z0-9]/-/g')
26+
TAG:=${TAG}-${RELEASE_VER}
3227
endif
3328

3429
.PHONY: print-global-variables

README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@ Refer to [deployment instructions here](./doc/deploy/deployment.md) on how to de
2020
1. Run the [mcad-release.yml](https://github.com/project-codeflare/actions/workflows/mcad-release.yml) action under `Actions` by entering the new release version in the `Release tag` input field and click `Run workflow`.
2121
![mcad-release](doc/images/mcad-release.png)
2222

23-
2. Verify that [mcad-release.yml](https://github.com/project-codeflare/actions/workflows/mcad-release.yml) action passed successfully. This workflow will create GitHub release tag.
23+
2. Verify that [mcad-release.yml](https://github.com/project-codeflare/actions/workflows/mcad-release.yml) action passed successfully. The workflow will Build and push the image to [mcad-controller quay repository](https://quay.io/repository/project-codeflare/mcad-controller?tab=tags) with specified release version tag and create GitHub release tag.
2424

25-
3. The release tag then trigger the [image build/push pipeline](https://app.travis-ci.com/github/project-codeflare/multi-cluster-app-dispatcher/branches) and push the image to [mcad-controller quay repository](https://quay.io/repository/project-codeflare/mcad-controller?tab=tags) with specified release version tag.
25+
3. Verify a new release is created on the [Releases page](https://github.com/project-codeflare/multi-cluster-app-dispatcher/releases).
2626

27-
4. Verify a new release is created on the [Releases page](https://github.com/project-codeflare/multi-cluster-app-dispatcher/releases) .
28-
29-
5. The latest release changes should also reflect in the [mcad go package module](https://pkg.go.dev/github.com/project-codeflare/multi-cluster-app-dispatcher).
27+
4. The latest release changes should also reflect in the [mcad go package module](https://pkg.go.dev/github.com/project-codeflare/multi-cluster-app-dispatcher).
3028

3129
## Tutorial
3230

0 commit comments

Comments
 (0)