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

Run tag_image_push workflows during PR builder [DI-315] #813

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

JackPGreen
Copy link
Collaborator

@JackPGreen JackPGreen commented Oct 24, 2024

The tag_image_push workflows are triggered only with a release, which means that any changes are not able to be tested.

Using a DRY_RUN mode we can execute the workflow as a non-destructive sanity check, without making any publicly observable changes.

Changes:

  • Add execution of tag_image_push workflows (in DRY_RUN mode) to PR builder
  • Add DRY_RUN mode to tag_image_push_rhel workflow
  • Extend tag_image_push workflow's DRY_RUN parameter by also skipping Dockerhub description/readme updates
  • Support calling tag_image_push workflows from other workflows via workflow_call (requires duplication of parameters)
  • update how we query inputs (github.event.inputs -> inputs) to support workflow_call executions
  • give log artifacts more unique names now were running more jobs at once to avoid collisions

Fixes: DI-315

Post-merge actions:

  • backport

The `tag_image_push` workflows are triggered _only_ with a release, which means that any changes are not able to be tested.

Using a `DRY_RUN` mode we can execute the workflow as a non-destructive sanity check, _without_ making any publicly observable changes.

Changes:
- Add execution of `tag_image_push` workflows (in `DRY_RUN` mode) to PR builder
- Add `DRY_RUN` mode to `tag_image_push_rhel` workflow
- Extend `tag_image_push` workflow's `DRY_RUN` parameter by also skipping Dockerhub description/readme updates
- Support calling `tag_image_push` workflows from other workflows via `workflow_call` ([require duplication of parameters](https://github.com/orgs/community/discussions/39357))
- Invert `DRY_RUN` check so that it _only_ runs if it's `false` (previously - ran always unless `true`) as a safety net for bad inputs (e.g. ``!)
@JackPGreen JackPGreen self-assigned this Oct 24, 2024
@JackPGreen JackPGreen requested a review from a team as a code owner October 24, 2024 20:44
@ldziedziul
Copy link
Contributor

  • Invert DRY_RUN check so that it only runs if it's false (previously - ran always unless true) as a safety net for bad inputs (e.g. ``!)

It was done on purpose to avoid backward incompatibility here:

If you change the default value of DRY_RUN then you have to add DRY_RUN flag in the lines above, but this won't work when rebuilding older versions without this flag. So you would have to backport DRY_RUN to older releases

@JackPGreen
Copy link
Collaborator Author

  • Invert DRY_RUN check so that it only runs if it's false (previously - ran always unless true) as a safety net for bad inputs (e.g. ``!)

It was done on purpose to avoid backward incompatibility here:

If you change the default value of DRY_RUN then you have to add DRY_RUN flag in the lines above, but this won't work when rebuilding older versions without this flag. So you would have to backport DRY_RUN to older releases

👍

f1ca0b4

@JackPGreen JackPGreen changed the title Run tag_image_push workflows during PR builder Run tag_image_push workflows during PR builder [DI-315] Oct 24, 2024
@nishaatr
Copy link
Contributor

Is this in relation to discussion we had to reduce Docker image testing during release?
https://hazelcast.atlassian.net/wiki/spaces/EN/pages/4681302104/Create+release+5.x#Docker-release-tag-test

BTW...JIRA needs parent, SP and description

@JackPGreen
Copy link
Collaborator Author

Is this in relation to discussion we had to reduce Docker image testing during release? https://hazelcast.atlassian.net/wiki/spaces/EN/pages/4681302104/Create+release+5.x#Docker-release-tag-test

Partially, but it's primarily to give test coverage for:

@JackPGreen JackPGreen enabled auto-merge (squash) November 2, 2024 21:58
@JackPGreen
Copy link
Collaborator Author

@ldziedziul are you able to take a look at this, please?

HZ_VERSION: ${{ needs.prepare.outputs.LAST_RELEASED_HZ_VERSION_OSS }}
RELEASE_VERSION: ${{ needs.prepare.outputs.LAST_RELEASED_HZ_VERSION_OSS }}
DRY_RUN: true
secrets: inherit
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm concerned that we pass all the secrets needed to do the actual push to the prod registry. What if one creates a PR and modifies tag_image_push.yml that DRY_RUN is not working anymore? We would end up with pushing broken image to prod.

WDYT about passing here secrets explicitly and only the ones that are used for read-only operations?

Copy link
Collaborator Author

@JackPGreen JackPGreen Nov 4, 2024

Choose a reason for hiding this comment

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

WDYT about passing here secrets explicitly and only the ones that are used for read-only operations?

I was trying to avoid a change to the push action necessitating a change to build-pr as well, but I can see your concern.

However, if they are passed explicitly, how are they accessed in the workflow? AFAIK with the with syntax it passes them as environment variables, so the ${{ secrets.MY_CRED }} would fail if MY_CRED was instead an environment variable?

Copy link
Contributor

Choose a reason for hiding this comment

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

There's also secrets section. Check the first example https://docs.github.com/en/enterprise-cloud@latest/actions/sharing-automations/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow:

jobs:
  call-workflow-passing-data:
    uses: octo-org/example-repo/.github/workflows/reusable-workflow.yml@main
    with:
      config-path: .github/labeler.yml
    secrets:
      personal_access_token: ${{ secrets.token }}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've tried in f1f1a3f

However the RHEL push needs the credentials for pushing, but also the preflight etc stuff we actually want to test, so it's still inherit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants