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

Validate stack during analyze phase #617

Merged
merged 3 commits into from Jun 16, 2021
Merged

Conversation

jabrown85
Copy link
Contributor

@jabrown85 jabrown85 commented May 12, 2021

During analyze, Platform 0.7 and above will validate the build and stack image if the data is available to do so.

Addresses Part of: #471

Spec being implemented:

The lifecycle MUST fail if the stack ID of the <run-image> does not match <stack-id>

Signed-off-by: Jesse Brown jabrown85@gmail.com

@jabrown85 jabrown85 self-assigned this May 12, 2021
@jabrown85 jabrown85 requested a review from a team as a code owner May 12, 2021 22:59
@jabrown85
Copy link
Contributor Author

oh jeez - nevermind . this doesn't address #471 yet - I thought that ticket was about making sure build and run images match..but maybe we do this anyway since it is related? 😬

The buildpack.toml check I can work on, but it is a different phase since you only want to validate for the selected group I assume?

@jabrown85
Copy link
Contributor Author

I put in this fix while working on this. buildpacks/spec#225

@jabrown85
Copy link
Contributor Author

@micahyoung I would love your assistance on fixing windows tests. I added skips for the 6 tests I would expect to pass. I am building platform specific run images but I was still seeing failures as if the run image wasn't in the registry. Is there something I need to do to be able to push a windows image into the ggcr registry? If you have any thoughts to try out let me know!

https://github.com/buildpacks/lifecycle/pull/617/checks?check_run_id=2612523589

@micahyoung
Copy link
Member

@jabrown85 Happy to take a look, as I know this is dragging on for ya. I'll see if I can get your current branch passing locally and send you a patch.

@codecov
Copy link

codecov bot commented May 18, 2021

Codecov Report

Merging #617 (c3697ee) into main (8e9b27e) will increase coverage by 1.63%.
The diff coverage is 81.64%.

❗ Current head c3697ee differs from pull request most recent head cc21037. Consider uploading reports for the commit cc21037 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main     #617      +/-   ##
==========================================
+ Coverage   64.90%   66.52%   +1.63%     
==========================================
  Files          52       60       +8     
  Lines        3623     3844     +221     
==========================================
+ Hits         2351     2557     +206     
+ Misses       1023     1020       -3     
- Partials      249      267      +18     
Flag Coverage Δ
os_linux 68.32% <81.82%> (?)
os_windows 64.96% <81.64%> (+0.07%) ⬆️
unit 68.32% <81.82%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

@natalieparellano
Copy link
Member

Did we answer the question of whether stack.toml should be required?

cmd/lifecycle/analyzer.go Outdated Show resolved Hide resolved
stack_validation.go Outdated Show resolved Hide resolved
stack_validation.go Outdated Show resolved Hide resolved
stack_validation_test.go Outdated Show resolved Hide resolved
utils_test.go Outdated Show resolved Hide resolved
utils_test.go Outdated Show resolved Hide resolved
utils_test.go Outdated Show resolved Hide resolved
utils_test.go Outdated
@@ -145,4 +146,38 @@ func testUtils(t *testing.T, when spec.G, it spec.S) {
}
})
})

when(".ResolveRunImage", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

If we deleted this . here, I think it's worth removing the . in the other when in this file.

  • ReadOrder
  • ReadGroup
  • WriteTOML
  • TruncateSha

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we want to remove .? I did it because it was requested, but I also am fine with leaving them and matching the style of the test that already exist. That is why I used the . in the first place...

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure. I think this is the only file that is using . and I'm not sure why.
Is there a reason for it?

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've seen this pattern before for denoting public method tests. #Method or .Method

I am happy to remove them all or match the style of the file

Copy link
Contributor

Choose a reason for hiding this comment

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

But we're usually testing public methods and I have never seen this style anywhere else, but maybe I'm wrong and I just missed it.
Anyway, my first thought was about removing it but I don't have a strong opinion about it.

Copy link
Member

Choose a reason for hiding this comment

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

Just curious, when do we use . vs #? (I've seen "object method" vs "static method" in other languages but I'm not sure what is our convention.) That said I don't have an opinion here.

utils_test.go Outdated Show resolved Hide resolved
@jabrown85 jabrown85 force-pushed the jab/validate-stack branch 2 times, most recently from 5ec05dc to 3fa6b3a Compare June 8, 2021 17:10
@natalieparellano
Copy link
Member

This is looking great! The acceptance tests require a certain amount of concentration and navigating around to follow, so I added some suggestions for comments that might make it easier to understand.

@jabrown85
Copy link
Contributor Author

@natalieparellano I'd like to squash everything so I can more easily fix the conflict on main. Let me know when you've had a chance to review the later commits. I don't want to take away your ability to review easily

@natalieparellano
Copy link
Member

@natalieparellano I'd like to squash everything so I can more easily fix the conflict on main. Let me know when you've had a chance to review the later commits. I don't want to take away your ability to review easily

@jabrown85 go for it!

@jabrown85 jabrown85 force-pushed the jab/validate-stack branch 2 times, most recently from 27321c7 to 2cfc635 Compare June 14, 2021 15:42
During analyze, Platform 0.7 and above will validate the build and stack image if the data is available to do so.

Addresses: #471

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Copy link
Member

@natalieparellano natalieparellano left a comment

Choose a reason for hiding this comment

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

Do we need to add logic for the creator?

@natalieparellano natalieparellano dismissed their stale review June 14, 2021 19:08

Forgot about the creator :/

Signed-off-by: Jesse Brown <jabrown85@gmail.com>
Signed-off-by: Jesse Brown <jabrown85@gmail.com>
@jabrown85
Copy link
Contributor Author

@natalieparellano creator should now be good to go after cc21037 and 55c17a5

@@ -64,6 +66,30 @@ func DecodeLabel(image imgutil.Image, label string, v interface{}) error {
return nil
}

func ResolveRunImage(stackMD platform.StackMetadata, destinationImageRef string) (string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Could we add a docs comment here?

@natalieparellano natalieparellano merged commit 7c5f36b into main Jun 16, 2021
@natalieparellano natalieparellano deleted the jab/validate-stack branch June 16, 2021 17:31
natalieparellano added a commit that referenced this pull request Jun 24, 2021
This reverts commit 7c5f36b, reversing
changes made to 162090f.
natalieparellano added a commit that referenced this pull request Jun 24, 2021
Revert "Merge pull request #617 from buildpacks/jab/validate-stack"
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.

None yet

4 participants