-
Notifications
You must be signed in to change notification settings - Fork 293
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
added targets flag for buildpack new cli #1921
Conversation
Signed-off-by: WYGIN <[email protected]>
Signed-off-by: WYGIN <[email protected]>
Signed-off-by: WYGIN <[email protected]>
Signed-off-by: WYGIN <[email protected]>
@jjbustamante i am unsure why the tests are failing & i tried to run tests on main branch & undoing all changes i made in my current branch, but still getting same result :( are these tests are failing due to my changes ? |
Let me check, I tried yesterday to check the logs but I was not able to. |
I think I know what is going on, if you take a look at your change in internal/commands/buildpack_new_test.go you said:
But in the line 78 path := filepath.Join(tmpDir, "some-cnb")
command.SetArgs([]string{"--path", path, "example/some-cnb"}) Where you are actually setting the flags to the A suggestion, do not modify the current tests just add a new test case for the new scenario. when("BuildpackNew#Execute", func() {
it("uses the args to generate artifacts", func() {
// This is the current existing test
}
}) You could modify it in this way: when("BuildpackNew#Execute", func() {
it("uses the args to generate artifacts", func() {
// This is the current existing test
}
when("targets is specified", func() {
it("uses the targets to generate artifacts", func(){
// Copy here copy from the previous test, and modify it as you need.
// Also any refactor is valid to avoid code duplication
}
}
}) |
Signed-off-by: WYGIN <[email protected]>
Signed-off-by: WYGIN <[email protected]>
Signed-off-by: WYGIN <[email protected]>
@jjbustamante @natalieparellano pr is ready for review, please let me know if there there is something to fix |
Signed-off-by: WYGIN <[email protected]>
Signed-off-by: WYGIN <[email protected]>
@WYGIN Amazing work! I compiled your branch and played with it. I have a little doubt with one scenario, @natalieparellano maybe you can help me to validate the expected behavior. I ran the example from our docs > out/pack buildpack new examples/ruby \
--api 0.8 \
--path ruby-buildpack \
--version 0.0.1 \
--stacks io.buildpacks.samples.stacks.jammy
Flag --stacks has been deprecated, prefer `--targets` instead: https://github.com/buildpacks/rfcs/blob/main/text/0096-remove-stacks-mixins.md
create buildpack.toml
create bin/build
create bin/detect
Successfully created examples/ruby The structure was created, but checking the > cat ruby-buildpack/buildpack.toml
api = "0.8"
WithWindowsBuild = false
WithLinuxBuild = false
[buildpack]
id = "examples/ruby"
version = "0.0.1"
[[stacks]]
id = "io.buildpacks.samples.stacks.jammy"
[[targets]]
os = "darwin"
arch = "amd64" We have By the way, I checked the latest pack version > cat ruby-buildpack/buildpack.toml
api = "0.8"
WithWindowsBuild = false.
WithLinuxBuild = false
[buildpack]
id = "examples/ruby"
version = "0.0.1"
[[stacks]]
id = "io.buildpacks.samples.stacks.jammy" @jkutner Should |
if i am not wrong it is part of build time but i think we can add a warning for
i think i am also thinking about adding cli |
Signed-off-by: WYGIN <[email protected]>
Signed-off-by: WYGIN <[email protected]>
Signed-off-by: WYGIN <[email protected]>
@jjbustamante i would like to know if there are any changes still required, i am willing to work on this issue(#1632 ) if i am done with this pr |
Yes, the validation is executed during build time, but, what I am totally happy with is the following:
|
ID: "io.buildpacks.stacks.jammy", | ||
Mixins: []string{}, | ||
}}, | ||
Targets: targets, |
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.
Based on my comment here, I will remove this Targets: targets
.
- IF users specifies only
stacks
, I don't wanttargets
to be added inbuildpack.toml
, the warning message is great and we will keep the current behavior of pack. - IF users specifies
stacks
andtargets
then both are allow for now, untilstacks
is actually deprecated. Based on this slack thread
Signed-off-by: WYGIN <[email protected]>
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.
@WYGIN thank you so much for this PR!! ❤️ , it is going to be very valuable for our end goal for supporting multi-arch!
Great job!
@buildpacks/platform-maintainers can you take a look at this? and merge if everything is fine. |
Summary
--targets
topack buildpack new
with shorthand-t
--targets
will take args in format [os][/arch][/archvariant]:[distroName@version@another-version];[another-distro@v1@v2]--stacks
flag deprecatedid
of stacks no more exists in filebuildpack.toml
[[stacks]]
frombuildpack.toml
file--target
of current device whentarget
flag is not specifiedbuildpack.toml
fileOutput
Before
pack buildpack new test
After
pack buildpack new test -t "linux/arm/v6" -t "linux/amd64" -t "windows/amd64:[email protected]" -t "linux/arm/v6:[email protected]" -t "linux/arm/v6:[email protected]" -t "linux/arm/v6:[email protected]@16.02;[email protected]@8.06"
Documentation
--targets
flagRelated
Resolves #1918