Skip to content
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

chore(ci): build images from tags, build next nightly #2218

Merged
merged 6 commits into from
Jan 24, 2025
Merged
Changes from 4 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
22 changes: 15 additions & 7 deletions .github/workflows/next-build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

name: Build Next Image
name: Build Next and Tag Image

on:
schedule:
kadel marked this conversation as resolved.
Show resolved Hide resolved
# run at 3:18 UTC every day
- cron: "18 3 * * *"
Copy link
Member

Choose a reason for hiding this comment

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

I'm confused why you want to switch from "on every push to main" to "once a day"... are we trying to reduce noise ? server usage? data centre heat causing global warming?

Copy link
Member Author

Choose a reason for hiding this comment

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

If you do "on every push to main" than every time, there is a new commit on main, the running job gets canceled, and a new one is trigerred. Which makes sense because otherwise you are building something that is already out of date.

To complete a full multiplatform image build, which typically takes over 5 hours, you’d need at least five consecutive hours without merging any pull requests (PRs) into main.
During regular workdays, with multiple PRs being merged daily, this job will likely get triggered and canceled repeatedly until nighttime when there’s less activity.

Copy link
Member

Choose a reason for hiding this comment

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

FIVE HOURS? What's it doing, compiling every single dependent package from sources??

Copy link
Member

Choose a reason for hiding this comment

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

also you can turn off the concurrency settings to cancel in-progress builds if you don't want things to be cancelled and started over:

https://github.com/redhat-developer/rhdh/blob/main/.github/workflows/next-build-image.yaml#L24

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, but if we don't cancel it than we are building something that is is never going to be used

Copy link
Member Author

Choose a reason for hiding this comment

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

FIVE HOURS? What's it doing, compiling every single dependent package from sources??

arm build takes this long becuase it is running in emualated environment

push:
branches:
- main
tags:
kadel marked this conversation as resolved.
Show resolved Hide resolved
- '[0-9]+.[0-9]+.[0-9]+'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -50,6 +53,11 @@ jobs:
- name: Prepare
run: |
platform=${{ matrix.platform }}
ref_name=${{ github.ref_name }}
if [ "$ref_name" == "main" ]; then
ref_name="next"
fi
echo "REF_NAME=$ref_name" >> $GITHUB_ENV
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
echo "PLATFORM_ARCH=${platform#*/}" >> $GITHUB_ENV

Expand All @@ -66,8 +74,8 @@ jobs:
password: ${{ secrets.QUAY_TOKEN }}
imageName: ${{ env.REGISTRY_IMAGE }}
imageTags: |
type=raw,value=next-${{ env.PLATFORM_ARCH }}
type=raw,value=next-${{ env.SHORT_SHA }}-${{ env.PLATFORM_ARCH }}
type=raw,value=${{ env.REF_NAME }}-${{ env.PLATFORM_ARCH }}
type=raw,value=${{ env.REF_NAME }}-${{ env.SHORT_SHA }}-${{ env.PLATFORM_ARCH }}
imageLabels: quay.expires-after=14d
push: true
platform: ${{ matrix.platform }}
Expand Down Expand Up @@ -116,8 +124,8 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=next
type=raw,value=next-${{ env.SHORT_SHA }}
type=raw,value=${{ env.REF_NAME }}
type=raw,value=${{ env.REF_NAME }}-${{ env.SHORT_SHA }}

- name: Login to Docker Hub
uses: docker/login-action@v3
Expand Down
Loading