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

🐛 Update packngo calls #377

Merged
merged 5 commits into from
Jul 25, 2022
Merged

🐛 Update packngo calls #377

merged 5 commits into from
Jul 25, 2022

Conversation

cprivitere
Copy link
Member

Add default gitversion to version.go

Signed-off-by: Chris Privitere 23177737+cprivitere@users.noreply.github.com

What this PR does / why we need it:
Fix the useragent code added in the last PR.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

Add default gitversion to version.go

Signed-off-by: Chris Privitere <23177737+cprivitere@users.noreply.github.com>
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 20, 2022
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 20, 2022
@cprivitere cprivitere marked this pull request as draft July 20, 2022 21:05
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 20, 2022
@cprivitere cprivitere removed the request for review from jacobsmith928 July 20, 2022 21:05
@displague
Copy link
Member

displague commented Jul 20, 2022

I see that there is a pattern of calling packet.GetClient() that avoids the need for fetching the environment variables in multiple locations.

We can use this pattern to avoid using different call patterns for interacting with the Equinix Metal API.
(I see some locations that refer to this as the Packet API, we should update those).

For E2E tests, by passing -ldflags "-X 'sigs.k8s.io/cluster-api-provider-packet/pkg/cloud/packet.clientName=capp-e2e' -X 'sigs.k8s.io/cluster-api-provider-packet/pkg/cloud/packet.clientUAFormat=capp-e2e/%s %s'", I believe we can get much of the same results.

Gingko, called in the Makefile task run-e2e-tests, accepts a -ldflags argument. I think we could move all of the custom consumertoken/useragent setting to this one location.

@cprivitere cprivitere changed the title ✨ Update packngo calls 🐛 Update packngo calls Jul 20, 2022
@cprivitere
Copy link
Member Author

Looks like the -ldflags strategy won't work as you can't use them on constants, only variables.
golang/go#22706

@cprivitere
Copy link
Member Author

Ok, actually I moved the constants into variables and now I'm getting the following:
DEBUG USER AGENT cluster-api-provider-packet/dev packngo/v0.25.0
DEBUG CONSUMER TOKEN capp-e2e-tilt

So i'm...50% successful at overriding the variables?

Signed-off-by: Chris Privitere <23177737+cprivitere@users.noreply.github.com>
@cprivitere
Copy link
Member Author

Our repo has locked this branch as protected again and I can no longer push updates to it.

Signed-off-by: Chris Privitere <23177737+cprivitere@users.noreply.github.com>
Signed-off-by: Chris Privitere <23177737+cprivitere@users.noreply.github.com>
@displague
Copy link
Member

Our repo has locked this branch as protected again and I can no longer push updates to it.

I re-deleted the branch protection rule. Try again.

@k8s-ci-robot k8s-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 Jul 25, 2022
@cprivitere cprivitere marked this pull request as ready for review July 25, 2022 16:55
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 25, 2022
use packet.newclient in suite_test
use ldflags to get capp-e2e clientname instead of explicitly calling it

Signed-off-by: Chris Privitere <23177737+cprivitere@users.noreply.github.com>
@@ -148,6 +148,7 @@ E2E_DIR ?= $(REPO_ROOT)/test/e2e
KUBETEST_CONF_PATH ?= $(abspath $(E2E_DIR)/data/kubetest/conformance.yaml)
E2E_CONF_FILE_SOURCE ?= $(E2E_DIR)/config/packet-ci.yaml
E2E_CONF_FILE ?= $(E2E_DIR)/config/packet-ci-envsubst.yaml
E2E_LD_FLAGS ?= "-X 'sigs.k8s.io/cluster-api-provider-packet/pkg/cloud/packet.clientName=capp-e2e' -X 'sigs.k8s.io/cluster-api-provider-packet/pkg/cloud/packet.clientUAFormat=capp-e2e/%s %s'"
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we could use GINKGO_ADDITIONAL_ARGS for this.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cprivitere, displague

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [cprivitere,displague]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@displague displague added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 25, 2022
@cprivitere cprivitere merged commit 0e32271 into main Jul 25, 2022
@cprivitere cprivitere deleted the fix-user-agent branch July 25, 2022 17:28
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", 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.

None yet

3 participants