-
Notifications
You must be signed in to change notification settings - Fork 288
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
Process project.toml for app source metadata #1231
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
3c12be1
Parsed project descriptor
Haimantika a35b2c2
Added project metadata file
Haimantika b30806a
Removed syntax errors
Haimantika d732d44
Changed the metadata.go and container_ops_test.go file according to t…
Haimantika c7a379c
Added struct in lifecycle_executor.go and some minute changes on the …
Haimantika 8c91798
Fix compiler errors
jromero c189f4b
Formatted
Haimantika 593a70e
Changed path and wrote acceptance test
Haimantika 912a83c
Testing for errors
Haimantika 6201391
Debugging
Haimantika e72eef4
Fixing errors
Haimantika a83e8bc
Fixing error pt 2
Haimantika 496c40d
Corrected printf to sprintf
Haimantika 79a16be
Fixed sprintf and whitespace issue
Haimantika e955e6a
New changes with tests working locally
Haimantika 9eed9b3
Update acceptance/acceptance_test.go
Haimantika 7f390eb
Applied suggested changes
Haimantika bbcb9e2
Solved the conflict
Haimantika 2dff56c
Fixed formatting
Haimantika 9046f76
Corrected the json in acceptance_test.go
Haimantika 7897d8e
Tried fixing the registry error
Haimantika 5f0113a
Changes made in acceptance test
Haimantika 210c064
Parathesis issue fixing
Haimantika 3d6b7c1
Re-do changes
Haimantika 946e2e6
Paranthesis error fixed
Haimantika File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[project] | ||
version = "1.0.2" | ||
source-url = "https://github.com/buildpacks/pack" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
go: | ||
targets: | ||
- ./cmd/pack | ||
|
||
build: | ||
# The go.build.flags property allows you to override the default build | ||
# flags when compiling your program. | ||
flags: | ||
- -ldflags="-s -w -X 'github.com/buildpacks/pack.Version=#{PACK_VERSION}#'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,8 @@ import ( | |
"github.com/sclevine/spec" | ||
"github.com/sclevine/spec/report" | ||
|
||
"github.com/buildpacks/lifecycle/platform" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See "Import Groups" |
||
|
||
"github.com/buildpacks/pack/internal/build" | ||
"github.com/buildpacks/pack/internal/builder" | ||
"github.com/buildpacks/pack/internal/container" | ||
|
@@ -330,6 +332,98 @@ drwsrwsrwt 2 123 456 (.*) some-vol | |
}) | ||
}) | ||
|
||
when("#WriteProjectMetadata", func() { | ||
it("writes file", func() { | ||
containerDir := "/layers-vol" | ||
p := "/layers-vol/project-metadata.toml" | ||
if osType == "windows" { | ||
containerDir = `c:\layers-vol` | ||
p = `c:\layers-vol\project-metadata.toml` | ||
} | ||
|
||
ctrCmd := []string{"ls", "-al", "/layers-vol/project-metadata.toml"} | ||
if osType == "windows" { | ||
ctrCmd = []string{"cmd", "/c", `dir /q /n c:\layers-vol\project-metadata.toml`} | ||
} | ||
ctx := context.Background() | ||
ctr, err := createContainer(ctx, imageName, containerDir, osType, ctrCmd...) | ||
h.AssertNil(t, err) | ||
defer cleanupContainer(ctx, ctr.ID) | ||
|
||
writeOp := build.WriteProjectMetadata(p, platform.ProjectMetadata{ | ||
Source: &platform.ProjectSource{ | ||
Type: "project", | ||
Version: map[string]interface{}{ | ||
"declared": "1.0.2", | ||
}, | ||
Metadata: map[string]interface{}{ | ||
"url": "https://github.com/buildpacks/pack", | ||
}, | ||
}, | ||
}, osType) | ||
|
||
var outBuf, errBuf bytes.Buffer | ||
err = writeOp(ctrClient, ctx, ctr.ID, &outBuf, &errBuf) | ||
h.AssertNil(t, err) | ||
|
||
err = container.Run(ctx, ctrClient, ctr.ID, &outBuf, &errBuf) | ||
h.AssertNil(t, err) | ||
|
||
h.AssertEq(t, errBuf.String(), "") | ||
if osType == "windows" { | ||
h.AssertContains(t, outBuf.String(), `01/01/1980 12:00 AM 137 ... project-metadata.toml`) | ||
} else { | ||
h.AssertContains(t, outBuf.String(), `-rwxr-xr-x 1 root root 137 Jan 1 1980 /layers-vol/project-metadata.toml`) | ||
} | ||
}) | ||
|
||
it("has expected contents", func() { | ||
containerDir := "/layers-vol" | ||
p := "/layers-vol/project-metadata.toml" | ||
if osType == "windows" { | ||
containerDir = `c:\layers-vol` | ||
p = `c:\layers-vol\project-metadata.toml` | ||
} | ||
|
||
ctrCmd := []string{"cat", "/layers-vol/project-metadata.toml"} | ||
if osType == "windows" { | ||
ctrCmd = []string{"cmd", "/c", `type c:\layers-vol\project-metadata.toml`} | ||
} | ||
|
||
ctx := context.Background() | ||
ctr, err := createContainer(ctx, imageName, containerDir, osType, ctrCmd...) | ||
h.AssertNil(t, err) | ||
defer cleanupContainer(ctx, ctr.ID) | ||
|
||
writeOp := build.WriteProjectMetadata(p, platform.ProjectMetadata{ | ||
Source: &platform.ProjectSource{ | ||
Type: "project", | ||
Version: map[string]interface{}{ | ||
"declared": "1.0.2", | ||
}, | ||
Metadata: map[string]interface{}{ | ||
"url": "https://github.com/buildpacks/pack", | ||
}, | ||
}, | ||
}, osType) | ||
|
||
var outBuf, errBuf bytes.Buffer | ||
err = writeOp(ctrClient, ctx, ctr.ID, &outBuf, &errBuf) | ||
h.AssertNil(t, err) | ||
|
||
err = container.Run(ctx, ctrClient, ctr.ID, &outBuf, &errBuf) | ||
h.AssertEq(t, errBuf.String(), "") | ||
h.AssertNil(t, err) | ||
|
||
h.AssertContains(t, outBuf.String(), `[source] | ||
type = "project" | ||
[source.version] | ||
declared = "1.0.2" | ||
[source.metadata] | ||
url = "https://github.com/buildpacks/pack" | ||
`) | ||
}) | ||
}) | ||
when("#EnsureVolumeAccess", func() { | ||
it("changes owner of volume", func() { | ||
h.SkipIf(t, osType != "windows", "no-op for linux") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[project] | ||
version = "1.0.2" | ||
source-url = "https://github.com/buildpacks/pack" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Import Groups
Imports should be grouped into the following: