Skip to content

Create Github action for Image build and push #474

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

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
20 changes: 19 additions & 1 deletion .github/workflows/mcad-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will create a GitHub release tag
# This workflow will Build image and push to mcad quay repository and create a GitHub release tag

name: mcad Release
on:
Expand All @@ -9,6 +9,11 @@ on:
required: true
default: 'v0.0.0-dev'
type: string
quay-organization:
description: 'Quay organization used to push the built images to'
required: true
default: 'project-codeflare'
type: string

jobs:
release:
Expand All @@ -20,6 +25,8 @@ jobs:
steps:
- name: checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: check tag format
run: |
Expand All @@ -41,3 +48,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Build
run: make mcad-controller

- name: Image Build and Push
env:
GIT_BRANCH: ${{ github.event.inputs.tag }}
TAG: release-${{ github.event.inputs.tag }}
run: |
make images -e GIT_BRANCH=$GIT_BRANCH TAG=$TAG
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 }}

2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ script:
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make images; fi'
# Process 'make images' when running as a pull request
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then unset quay_repository && make images; fi'
# Process 'make push-images' when NOT a pull request
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make push-images; fi'
# Run the e2e and handle Travis condition where Travis fails on no output for 10 minutes. No output for 10 minutes
# is fine for our test cases that waits for 10 minutes before requeuing a job. The other workaround was to
# use 'travis_wait n' which unfortunately does not stream output until the very end so monitoring the Travis log
Expand Down
15 changes: 5 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,11 @@ endif

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

.PHONY: print-global-variables
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@ Refer to [deployment instructions here](./doc/deploy/deployment.md) on how to de
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`.
![mcad-release](doc/images/mcad-release.png)

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.
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.

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.
3. Verify a new release is created on the [Releases page](https://github.com/project-codeflare/multi-cluster-app-dispatcher/releases).

4. Verify a new release is created on the [Releases page](https://github.com/project-codeflare/multi-cluster-app-dispatcher/releases) .

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).
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).

## Tutorial

Expand Down