Skip to content

Create a GitHub action for Build Image and push against main branch #563

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

Conversation

Srihari1192
Copy link
Contributor

@Srihari1192 Srihari1192 commented Aug 10, 2023

Issue link

#559

What changes have been made

  • Added Github action for image build and push
  • Removed travis.yml file to skip travis CI build trigger and adjusted Makefile
  • Updated latest to dev for tag to align with release process

Verification steps

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

@Srihari1192 Srihari1192 requested a review from z103cb August 10, 2023 12:49
@openshift-ci openshift-ci bot requested review from asm582 and astefanutti August 10, 2023 12:49
@Srihari1192 Srihari1192 requested review from sutaakar, asm582 and anishasthana and removed request for astefanutti and asm582 August 10, 2023 12:49
@Srihari1192
Copy link
Contributor Author

Tested the workflow changes in fork repository https://github.com/Srihari1192/multi-cluster-app-dispatcher/actions/runs/5820949721

on:
push:
branches:
- '*'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- '*'
- 'main'

To make sure that only push to main branch produce new image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used * because of from travis CI builds noted that we are running all the branches in upstream to build and push images to the respective branch-tag https://quay.io/repository/project-codeflare/mcad-controller?tab=tags .. If its not required we can keep this to only main

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to accommodate "patch" a release branch use case, @Srihari1192 will your code handle that use cases? (it seems that it would).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking what cases should we cover here:
New commit on main branch - new dev image published
New commit on release-<version> branch - new dev-release-<version> image published?
Any other case for producing non release image?

Those ^ are just my ideas, feel free to share your ideas.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sutaakar I think you have covered those. Is there any documentation how to "patch" a release? if we do that is great, if not we should create a separate issue / pr to create it.

I am Ok with restricting the branches to only the patterns you have outlined.

Copy link
Contributor

@sutaakar sutaakar Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any specific mention about patch release in readme. I would say it follows the similar flow as a normal release:

  • Create a release-<version> branch if not exists
  • Merge code changes until ready for patch release
  • Trigger a release workflow, specify release-<version> branch as a workflow source

Ideally this should build proper image and publish correct image tag, though I haven't tried it by myself.

Copy link
Contributor Author

@Srihari1192 Srihari1192 Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sutaakar @z103cb I think we can put condition for assigning tag value like this. so that in case of main branch and release branch image will be pushed to the respective tag .. wdyt?


` if [[ "$GIT_BRANCH"="main" ]]; then
             echo "TAG=dev" >> $GITHUB_ENV
          else [[ "$GIT_BRANCH" == release-* ]]; then
            echo "TAG=$GIT_BRANCH" >> $GITHUB_ENV
     fi

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in principle fine for me
just be careful on content of GIT_BRANCH, AFAIK for branch it is like refs/heads/<branch name>, see https://github.com/project-codeflare/codeflare-operator/blob/2a4731a237cf1996e6370def8c3dc7842fc2db52/.github/workflows/tag-and-build.yml#L150
Also I think that release-<branch name> format is used for released images, so you need some other name to distinguish it (i.e. like dev-release-<branch name>)

Copy link
Contributor Author

@Srihari1192 Srihari1192 Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay for release branch will update tag as dev-< release-branch>

run: |
BRANCH=$(echo ${GITHUB_REF#refs/heads/})
echo "GIT_BRANCH=$(echo "$BRANCH" | sed 's/[^A-Za-z0-9._-]/-/g' )" >> $GITHUB_ENV
echo "TAG=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
Copy link
Contributor

@sutaakar sutaakar Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As dev tag is used then you don't need to retrieve it from git, I suppose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if or what value needs to be supplied below for tests/build.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can assign "TAG=dev" directly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on:
push:
branches:
- '*'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to accommodate "patch" a release branch use case, @Srihari1192 will your code handle that use cases? (it seems that it would).

@Srihari1192 Srihari1192 force-pushed the build-push-559 branch 4 times, most recently from 077abea to 0134bf9 Compare August 11, 2023 11:38
@Srihari1192 Srihari1192 marked this pull request as ready for review August 11, 2023 12:11
@Srihari1192 Srihari1192 requested a review from z103cb August 11, 2023 12:11
@openshift-ci openshift-ci bot requested a review from dmatch01 August 11, 2023 12:11
Copy link
Contributor

@z103cb z103cb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/LGTM

Waiting for others to chime in.

@asm582
Copy link
Member

asm582 commented Aug 11, 2023

/lgtm

@asm582
Copy link
Member

asm582 commented Aug 11, 2023

/approve

@openshift-ci
Copy link

openshift-ci bot commented Aug 11, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: asm582, sutaakar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 514cafa into project-codeflare:main Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants