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: update cli to retrieve promotion commits for product release steps #758

Merged
merged 5 commits into from
Oct 23, 2024

Conversation

scme0
Copy link
Contributor

@scme0 scme0 commented Oct 22, 2024

What

Adding promotion commits to product release steps if the version of codefresh is compatible. I've added a fall back in case the cli is connected to an old version of codefresh (on prem).

Why

A customer wanted to know the commit created by promotions for each step of a product release for each application. See Jira ticket for details.

Notes

Jira: https://codefresh-io.atlassian.net/browse/CR-25720

if err != nil {
return fmt.Errorf("failed to get product releases: %w", err)
if strings.Contains(err.Error(), "Cannot query field \\\"promotionCommits\\\" on type \\\"ProductReleaseStep\\\".") {
log.G().Warn("codefresh version v0.13.4 or older detected. Using v0.13.4 query which excludes promotionCommits.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this warning, but now I'm not sure as if there are customers/internal users using this cli command in automation the extra log line of output would make it fail.

I can also just make it fallback silently?

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 that should be ok, showing a warning, but falling back to previous query.
this way they will know that something may work better if they upgrade their platform.

}
`

const v0_13_4_query = `
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update the specific version references once I've merged the argo-platform changes.

@scme0
Copy link
Contributor Author

scme0 commented Oct 23, 2024

I've tested this against g.codefresh while it runs a pre v1.3120.1 version and it correctly logs a warning and displays the results without the applications property.
I've also tested it against sandbox running a branch build of v1.3120.1 and it successfully returns the applications property.

@scme0 scme0 merged commit c9bb31c into main Oct 23, 2024
1 of 2 checks passed
@scme0 scme0 deleted the cr-25539 branch October 23, 2024 09:51
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