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

Oss 751 add release repo dispatch #755

Closed

Conversation

xsalefter
Copy link
Contributor

Original issue: #751

See complete explanation here: killbill/gh-actions-shared#41

@xsalefter xsalefter requested a review from pierre June 9, 2023 04:25
name: release-repo-dispatch

on:
repository_dispatch:
Copy link
Member

Choose a reason for hiding this comment

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

Should we specify the type for safety here?

on:
    repository_dispatch:
        types: [update_killbill-commons_version]

update_version_from_repository_dispatch:
uses: killbill/gh-actions-shared/.github/workflows/update-version.yml@main

# If CI failed, should we revert commit? I don't think so, since we still have release.yml with "workflow_dispatch",
Copy link
Member

@pierre pierre Jun 20, 2023

Choose a reason for hiding this comment

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

I think we should run CI in parallel. It takes a very long time + as you said, we can fix things manually (this would be in other repos and wouldn't be a release blocker).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"parallel" means we don't need to call needs: update_version_from_repository_dispatch so each job will run together? But we need to update version before we run build and release, no?

uses: ./.github/workflows/ci.yml
needs: update_version_from_repository_dispatch

release:
Copy link
Member

Choose a reason for hiding this comment

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

To your comment (https://github.com/killbill/gh-actions-shared/pull/41/files#r1232894706), I'm thinking indeed that we don't need to share that workflow.

But I also think we don't even need it. You could just call release.yml and specify the new version to update:

description: 'New killbill-commons version'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

.... You could just call release.yml and specify the new version to update:

@pierre do you mean as something like:

....

    release-jobs:
      name: "Test Various Workflow"
      uses: ./.github/workflows/dispatch_and_call.yml
      with:
        commons_version: <from_repository_dispatch>
....

? If so, it is not working. See this action result (hello_msg and is_exist is not set at all). This is repeatable and you can try here. main workflow file that simulate our release.yml is here.

Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need the shared workflow (nor this PR).

In https://github.com/killbill/killbill-commons/pull/167/files#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R118, could you call the workflow dispatch to trigger the existing release.yml workflow (and specify commons_version in the payload)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pierre I update PR in commons. The payload now:

"{\"event_type\":\"update_kb_commons_version\", \"client_payload\": {\"commons_version\": \"$PROJECT_VERSION\"}}"

you can give a feedback.

As PR in this repo, I think we need at least:

repository_dispatch:
    types: [update_kb_commons_version, update_kb_base_plugin_version, update_kb_platform_version, update_kb_client_version]

as you mentioned above, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Btw, I don't think that this is will work. Variables from repository_dispatch's payload will be github.event.client_payload.*, and what workflow_dispatch will be github.event.inputs.*.

I tried to set default like this:

....
inputs:
      hello-msg:
        description: "Hello Message"
        type: string
        required: false
        default: ${{ github.event.client_payload.hello-msg }}

but this is not valid.

@xsalefter xsalefter force-pushed the oss-751-add_release_repo_dispatch branch from 9f11e09 to c9a94e8 Compare July 11, 2023 14:11
@xsalefter xsalefter force-pushed the oss-751-add_release_repo_dispatch branch from c9a94e8 to 93d26ea Compare July 11, 2023 14:20
@xsalefter xsalefter requested a review from pierre July 11, 2023 14:24
@xsalefter
Copy link
Contributor Author

Close this PR. killbill-commons (and other involved repositories) will just call workflow_dispatch API directly to the release.yml workflow file. For killbill-commons, see this PR.

@xsalefter xsalefter closed this Jul 12, 2023
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.

2 participants