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

Ext 283 remove legacy org slug #717

Merged
merged 5 commits into from
Jun 6, 2022

Conversation

corinnesollows
Copy link
Contributor

Checklist

=========

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked for similar issues and haven't found anything relevant.
  • This is not a security issue (which should be reported here: https://circleci.com/security/)
  • I have read Contribution Guidelines.

Changes

=======

  • Added the ability to use orgId when running local execute
  • If orgId is not provided an orgSlug can still be used

Considerations

==============

In case of users currently using the legacy slug org, it remains for now.

@corinnesollows corinnesollows requested a review from a team as a code owner May 31, 2022 13:11
@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #717 (e9914b6) into master (c3ad28b) will decrease coverage by 0.31%.
The diff coverage is 5.00%.

@@            Coverage Diff             @@
##           master     #717      +/-   ##
==========================================
- Coverage   28.82%   28.50%   -0.32%     
==========================================
  Files          42       42              
  Lines        4860     4925      +65     
==========================================
+ Hits         1401     1404       +3     
- Misses       3261     3323      +62     
  Partials      198      198              
Impacted Files Coverage Δ
api/api.go 3.62% <0.00%> (-0.16%) ⬇️
local/local.go 38.39% <7.14%> (-2.96%) ⬇️
cmd/config.go 28.57% <7.69%> (-2.92%) ⬇️
cmd/build.go 86.36% <100.00%> (+0.64%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c3ad28b...e9914b6. Read the comment docs.

@@ -17,6 +17,7 @@ func newLocalExecuteCommand(config *settings.Config) *cobra.Command {

local.AddFlagsForDocumentation(buildCommand.Flags())
buildCommand.Flags().StringP("org-slug", "o", "", "organization slug (for example: github/example-org), used when a config depends on private orbs belonging to that org")
buildCommand.Flags().String("org-id", "", "organization id, used when a config depends on private orbs belonging to that org")
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick here but I'd argue keeping the wording the same (or extract to a variable even) for the three <command>.Flags().String("org-id"...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you give a full example? The wording is the same as far as I can see...

Copy link
Contributor

Choose a reason for hiding this comment

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

in cmd/config.go we have:

processCommand.Flags().String("org-id", "", "organization id used when a config depends on private orbs belonging to that org")

validateCommand.Flags().String("org-id", "", "organization id used when a config depends on private orbs belonging to that org")

in retrospect they're almost identical (just a comma that's different). Will leave it up to you if you think it's worth extracting to a variable.

@joeyorlando
Copy link
Contributor

few minors comments, aside from that LGTM!

@corinnesollows
Copy link
Contributor Author

Hey @joeyorlando , this isnt ready for review. lol
Great initiative though!


// ConfigQuery calls the GQL API to validate and process config with the org id
func ConfigQuery(cl *graphql.Client, configPath string, orgId string, params pipeline.Parameters, values pipeline.Values) (*ConfigResponse, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick so optional, but I think we're capitalizing ID in the rest of the project, so orgID.

// ConfigQuery calls the GQL API to validate and process config
func ConfigQuery(cl *graphql.Client, configPath string, orgSlug string, params pipeline.Parameters, values pipeline.Values) (*ConfigResponse, error) {
// ConfigQueryLegacy calls the GQL API to validate and process config with the legacy orgSlug
func ConfigQueryLegacy(cl *graphql.Client, configPath string, orgSlug string, params pipeline.Parameters, values pipeline.Values) (*ConfigResponse, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can simplify these two functions (ConfigQuery, and ConfigQueryLegacy) into one. Since this is graph, couldn't we just send everything that we've collected, like both the org slug and orgID? The API should already be handling this logic so there's no need to do it here too.

Copy link
Contributor Author

@corinnesollows corinnesollows Jun 6, 2022

Choose a reason for hiding this comment

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

We tried that at first, remember? Graph did not like it when one of those fields wasn't sent. Keeping the methods separate will also allow us to remove the legacy code easier in the future. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Really? I just tried refactoring it locally and it worked just fine? Not a big deal though but I think less code is better than more code. Let me know if you want to spend the time to refactor it and I can help ya out :D

@corinnesollows corinnesollows merged commit e96ff59 into master Jun 6, 2022
@corinnesollows corinnesollows deleted the EXT-283-remove-legacy-org-slug branch June 6, 2022 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.

3 participants