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

feat: ensure Bitbucket repo URLs use HTTPS scheme #406

Merged
merged 2 commits into from
Mar 26, 2024
Merged

Conversation

maxrake
Copy link
Contributor

@maxrake maxrake commented Mar 26, 2024

This change was made after discovering that Atlassian Compass components
recognize Bitbucket repository URLs only when they are HTTPS: and not
when they are HTTP:, even though that is how the URL is provided when
obtained by getting the BITBUCKET_GIT_HTTP_ORIGIN environment variable
value.

Additionally, the is_token_set function was refactored to adhere to
the new ruff preview rule SIM103. The latest release of ruff
introduced the new linting rule SIM103: needless-bool,
which causes the code in question to fail when run in preview mode. This
change was made now to get ahead of the rule, for when it enforces the
implicit else cases by default. The change was made in a way that
seeks to maintain readability and intent. Type annotations were added to
the affected function as well.

Testing / Screenshots

What a Bitbucket pipeline looks like when run with the changes from this PR:

image

Updating the repo URL manually:

❯ phylum project list -g integrations
Project Name  Project ID                            Repository URL
---TRIMMED---
TestBB        935bdc06-13e8-4ead-a2b7-e679c69b8970  http://bitbucket.org/phylum-maxrake/testbb
---TRIMMED

❯ phylum project update -i 935bdc06-13e8-4ead-a2b7-e679c69b8970 -g integrations -r https://bitbucket.org/phylum-maxrake/testbb
✅ Successfully updated project "935bdc06-13e8-4ead-a2b7-e679c69b8970" (group "integrations"):
      Name: "TestBB" -> "TestBB"
      Repository URL: "http://bitbucket.org/phylum-maxrake/testbb" -> "https://bitbucket.org/phylum-maxrake/testbb"

❯ phylum project list -g integrations
Project Name  Project ID                            Repository URL
---TRIMMED---
TestBB        935bdc06-13e8-4ead-a2b7-e679c69b8970  https://bitbucket.org/phylum-maxrake/testbb
---TRIMMED---

Re-running the pipeline:

image

maxrake added 2 commits March 26, 2024 13:24
This change was made after discovering that Atlassian Compass components
recognize Bitbucket repository URLs only when they are `HTTPS:` and not
when they are `HTTP:`, even though that is how the URL is provided when
obtained by getting the `BITBUCKET_GIT_HTTP_ORIGIN` environment variable
value.
The latest release of `ruff` introduced the new linting rule
[SIM103: needless-bool](https://docs.astral.sh/ruff/rules/needless-bool)
which causes the code in question to fail when run in preview mode. This
change was made now to get ahead of the rule, for when it enforces the
implicit `else` cases by default. The change was made in a way that
seeks to maintain readability and intent. Type annotations were added to
the affected function as well.
@maxrake maxrake self-assigned this Mar 26, 2024
@maxrake maxrake requested a review from a team as a code owner March 26, 2024 18:47
@maxrake maxrake requested a review from matt-phylum March 26, 2024 18:47
@maxrake maxrake merged commit 5ea8cb2 into main Mar 26, 2024
13 checks passed
@maxrake maxrake deleted the bb_repo_url branch March 26, 2024 19:16
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