Skip to content

Conversation

@jhadvig
Copy link
Member

@jhadvig jhadvig commented Jan 13, 2020

/assign @spadgett

@openshift-ci-robot
Copy link
Contributor

@jhadvig: This pull request references Bugzilla bug 1789979, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Bug 1789979: Fix webhook triggers hooks to re-run on prop change

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 13, 2020
@openshift-ci-robot openshift-ci-robot added the component/core Related to console core functionality label Jan 13, 2020
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const webhookTriggersTypes = new Set<TriggerTypes>([
const webhookTriggerTypes = new Set<TriggerTypes>([

Copy link
Member

Choose a reason for hiding this comment

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

I believe this is going to re-fetch all the secrets on any build config change (not just on changes to triggers).

Copy link
Member Author

Choose a reason for hiding this comment

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

@spadgett tested this use-case and BC1 was not re-fetched if I updated BC2 (with adding trigger or build strategy parameters)

Copy link
Member

Choose a reason for hiding this comment

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

I mean any change to the current build config. For instance, I believe it will fetch all secrets again if, say, an annotation changes.

@jhadvig jhadvig force-pushed the bz1789979 branch 3 times, most recently from 93d5244 to fc4866c Compare January 14, 2020 01:56
@jhadvig
Copy link
Member Author

jhadvig commented Jan 14, 2020

@spadgett I've updated the PR. To prevent re-fetching of the secrets when any non-trigger changes are made we'll compare the next and previous webhookTriggers. If they match no changes are made to the webhookTriggers and so no secrets will be fetched. Otherwise fetch all the webhookTrigger secrets.
It is more simple solution then looking for changes in the webhookTriggers, since that would require more complex handling of the webhookTriggers, secret loading, errors, etc.

@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 14, 2020
@jhadvig
Copy link
Member Author

jhadvig commented Jan 14, 2020

@spadgett @TheRealJon comments addressed. PTAL

Copy link
Member

Choose a reason for hiding this comment

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

Will adding webhookTriggers as a dep cause issues here since it is updated within this effect?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should not since the webhookTriggers will be updated only when the webhookTriggers are update(added/removed)

Copy link
Member

@TheRealJon TheRealJon Jan 14, 2020

Choose a reason for hiding this comment

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

Recommend using functional form of setState here, that way we don't have to have webHookTriggers as a dep in this effect. https://reactjs.org/docs/hooks-reference.html#functional-updates

  React.useEffect(() => {
    setWebhookTriggers((previousTriggers) => {
      const newTriggers = _.filter(triggers, ({ type }) => webhookTriggerTypes.has(type));
      return _.isEqual(previousTriggers, newTriggers) ? previousTriggers : newTriggers;
    });
  }, [triggers]);

@jhadvig
Copy link
Member Author

jhadvig commented Jan 14, 2020

@TheRealJon thanks for the suggestion. PR updated.

Copy link
Member

@TheRealJon TheRealJon left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 14, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhadvig, TheRealJon

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

The pull request process is described here

Details 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 ea3a565 into openshift:master Jan 14, 2020
@openshift-ci-robot
Copy link
Contributor

@jhadvig: All pull requests linked via external trackers have merged. Bugzilla bug 1789979 has been moved to the MODIFIED state.

Details

In response to this:

Bug 1789979: Fix webhook triggers hooks to re-run on prop change

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.4 milestone Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants