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

fix(gitlab): Modify GitLab CI resource ids #4647

Merged
merged 2 commits into from
Mar 13, 2023

Conversation

Eliran-Turgeman
Copy link
Contributor

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

New/Edited policies (Delete if not relevant)

Description

Include a description of what makes it a violation and any relevant external links.

Fix

How does someone fix the issue in code and/or in runtime?

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules


def generate_resource_key_recursive(conf: dict[str, Any] | list[str] | str, key: str, start_line: int,
end_line: int) -> str:
return _generate_resource_key_recursive(conf, key, start_line, end_line, set(), 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of creating another method you can just set the last two arguments as optional params in generate_resource_key_recursive and set their default value to set() and zero.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good, but scanned_image_blocks should be None as default, otherwise you have a mutable object as default, which will result in some surprises, not good ones 😄

@maxamel
Copy link
Contributor

maxamel commented Mar 12, 2023

Seems the test results of test_runner_image_resources should also be changed somehow, since it currently also produces same resource for several images 😄

@Eliran-Turgeman
Copy link
Contributor Author

Seems the test results of test_runner_image_resources should also be changed somehow, since it currently also produces same resource for several images 😄

That's a limitation we have since strings do not have the start line and end line fields.
I think we should merge this one as it will solve some of the edge cases.

@Eliran-Turgeman Eliran-Turgeman merged commit 39be80d into main Mar 13, 2023
@Eliran-Turgeman Eliran-Turgeman deleted the make_gitlab_ci_resource_id_more_descriptive branch March 13, 2023 13:25
reemodo pushed a commit that referenced this pull request Mar 13, 2023
* gitlab ci resource ids

* lint

---------

Co-authored-by: Eliran Turgeman <elturgeman@paloaltonetworks.com>
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.

None yet

4 participants