-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extracting the definition of the no spec project descriptor to a diff…
…erent file Signed-off-by: Juan Bustamante <jbustamante@vmware.com>
- Loading branch information
1 parent
381d506
commit e15e027
Showing
2 changed files
with
39 additions
and
32 deletions.
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,36 @@ | ||
package cnb | ||
|
||
// A descriptorV2NoSpec represents a project descriptor that uses the key io.buildpacks.env to set environment variables | ||
// This key is not defined in the Project Descriptor V2, but was added by mistake in the PR https://github.com/pivotal/kpack/pull/810 | ||
// and this struct is created to guarantee compatibility | ||
type descriptorV2NoSpec struct { | ||
Project project `toml:"_"` | ||
IO ioTableNoSpec `toml:"io"` | ||
} | ||
|
||
type ioTableNoSpec struct { | ||
Buildpacks cnbTableV2NoSpec `toml:"buildpacks"` | ||
} | ||
|
||
type cnbTableV2NoSpec struct { | ||
build `toml:",inline"` | ||
Env []envVariable `toml:"env"` | ||
Group []buildpack `toml:"group"` | ||
} | ||
|
||
func v2NoSpecToV2(v2 descriptorV2NoSpec) descriptorV2 { | ||
return descriptorV2{ | ||
Project: v2.Project, | ||
IO: ioTable{ | ||
Buildpacks: cnbTableV2{ | ||
build: v2.IO.Buildpacks.build, | ||
Group: v2.IO.Buildpacks.Group, | ||
buildEnvVariableV2: buildEnvVariableV2{ | ||
BuildEnv: buildEnvVariable{ | ||
Env: v2.IO.Buildpacks.Env, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
} |