Skip to content

Conversation

@CuriousLearner
Copy link
Contributor

@CuriousLearner CuriousLearner commented May 25, 2024

Fixes #44

Presents error on

apppack -a pipeline build start

&

apppack -a pipeline:{pr} build start

if the review app does not exist.

@CuriousLearner CuriousLearner marked this pull request as ready for review May 28, 2024 20:08
Copy link
Member

@ipmb ipmb left a comment

Choose a reason for hiding this comment

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

GetReviewApps is going to be slow. You shouldn't need to iterate over all the values to see if this one exists, just try to read the specific parameter for this app.

@CuriousLearner CuriousLearner requested a review from ipmb May 29, 2024 17:28
app/app.go Outdated
if !a.Pipeline {
return false, fmt.Errorf("%s is not a pipeline and cannot have review apps", a.Name)
}
_, err := SsmParameter(a.Session, fmt.Sprintf("/apppack/pipelines/%s/review-apps/pr/%s", a.Name, *a.ReviewApp))
Copy link
Member

Choose a reason for hiding this comment

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

You might actually need to check the value of this. It should be JSON with a status key that needs a value of created. See https://github.com/apppackio/apppack/blob/main/cmd/reviewapps.go#L46

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll take a look.

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 had a look, and it seems like that the parameter in this case will only exist if the reviewapp exists. Isn't that correct? Since we only are concerned with review app existing, why would it matter for it to be in the created status?

Copy link
Member

Choose a reason for hiding this comment

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

The parameter gets created when the PR is created at GitHub. That functionality is in the builder here, https://github.com/apppackio/apppack-codebuild-image/blob/main/builder/build/prebuild.go#L301-L304

In that case, the parameter will exist, but the review app will not.

@CuriousLearner CuriousLearner requested a review from ipmb June 3, 2024 23:52
@CuriousLearner CuriousLearner merged commit d99e82a into main Jun 4, 2024
@CuriousLearner CuriousLearner deleted the prevent-build-command-for-non-existent-review-app branch June 4, 2024 15:58
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.

Prevent build commands against a review app that doesn't exist

3 participants