-
Notifications
You must be signed in to change notification settings - Fork 5
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
Publish each version only once on gcom publish #192
Conversation
containers/gcom_publish.go
Outdated
|
||
_, err = d.Container().From("alpine/curl"). | ||
WithSecretVariable("GCOM_API_KEY", apiKeySecret). | ||
WithExec([]string{"/bin/sh", "-c", fmt.Sprintf(`curl -H "Content-Type: application/json" -H "Authorization: Bearer $GCOM_API_KEY" -d '%s' %s`, string(jsonVersionPayload), versionApiUrl)}). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're not redirecting stdout or anything this can just be []string{"curl", "-H', "Content-Type: application/json", etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we need the $GCOM_API_KEY would Dagger use the environment variable without calling /bin/sh ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea pretty sure it will. try it!
containers/gcom_publish.go
Outdated
|
||
// PublishGCOMPackage publishes a package to grafana.com. | ||
func PublishGCOMPackage(ctx context.Context, d *dagger.Client, packagePayload *GCOMPackagePayload, opts *GCOMOpts, version string) error { | ||
packagesApiUrl := fmt.Sprintf("%s/api/grafana/versions/%s/packages", opts.URL, version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use paths.Join
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path.Join will get rid of the second / on "https://"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use url.URL then if you're making a URL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and path.Join to build the URL path
No description provided.