Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
Move images to the dev registry
Browse files Browse the repository at this point in the history
- reorganized assets in subfolder

[#169753481]

Signed-off-by: Velda Conaty <[email protected]>
  • Loading branch information
carlo-colombo authored and velcro-ie committed Nov 18, 2019
1 parent 1c358d5 commit f3eb0c8
Show file tree
Hide file tree
Showing 40 changed files with 62 additions and 59 deletions.
10 changes: 5 additions & 5 deletions pkg/image/image_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ var _ = Describe("Image", func() {
)

It("instantiates an image starting from a remote source", func() {
image, err = NewDeplabImage("pivotalnavcon/test-asset-all-file-types", "")
image, err = NewDeplabImage("dev.registry.pivotal.io/navcon/deplab-test-asset:all-file-types", "")

Expect(err).ToNot(HaveOccurred())
Expect(image).ToNot(BeNil())
})

It("instantiates an image starting from a tarball", func() {
inputTarPath, err := filepath.Abs("../../test/integration/assets/all-file-types.tgz")
inputTarPath, err := filepath.Abs("../../test/integration/assets/image-archives/all-file-types.tgz")
Expect(err).ToNot(HaveOccurred())

image, err = NewDeplabImage("", inputTarPath)
Expand All @@ -52,7 +52,7 @@ var _ = Describe("Image", func() {
})

It("returns an error if an invalid image at the tarball path", func() {
inputTarPath, err := filepath.Abs("../../test/integration/assets/invalid-image-archive.tgz")
inputTarPath, err := filepath.Abs("../../test/integration/assets/image-archives/invalid-image-archive.tgz")
Expect(err).ToNot(HaveOccurred())

_, err = NewDeplabImage("", inputTarPath)
Expand Down Expand Up @@ -82,7 +82,7 @@ var _ = Describe("Image", func() {
})

It("includes metadata in the label", func() {
inputTarPath, err := filepath.Abs("../../test/integration/assets/all-file-types.tgz")
inputTarPath, err := filepath.Abs("../../test/integration/assets/image-archives/all-file-types.tgz")
Expect(err).ToNot(HaveOccurred())

image, err = NewDeplabImage("", inputTarPath)
Expand Down Expand Up @@ -112,7 +112,7 @@ var _ = Describe("Image", func() {
})

It("returns an error if the destination path is invalid", func() {
inputTarPath, err := filepath.Abs("../../test/integration/assets/all-file-types.tgz")
inputTarPath, err := filepath.Abs("../../test/integration/assets/image-archives/all-file-types.tgz")
Expect(err).ToNot(HaveOccurred())

image, err = NewDeplabImage("", inputTarPath)
Expand Down
2 changes: 1 addition & 1 deletion pkg/image/rootfs_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ import (

func TestProviders(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "RootFS Suite")
RunSpecs(t, "Image Suite")
}
2 changes: 1 addition & 1 deletion pkg/image/rootfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var rfs RootFS
var _ = Describe("rootFS", func() {
Context("when there is a valid image archive", func() {
BeforeEach(func() {
inputTarPath, err := filepath.Abs("../../test/integration/assets/all-file-types.tgz")
inputTarPath, err := filepath.Abs("../../test/integration/assets/image-archives/all-file-types.tgz")
Expect(err).ToNot(HaveOccurred())

image, err := crane.Load(inputTarPath)
Expand Down
6 changes: 3 additions & 3 deletions push-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
set -eu -o pipefail
set -x

for dockerfile in integration/assets/Dockerfile* ; do
(cd integration/assets
for dockerfile in test/integration/assets/dockerfiles/Dockerfile* ; do
(cd test/integration/assets/dockerfiles
filename=$(basename $dockerfile)
image_name=pivotalnavcon/test-asset-${filename/Dockerfile./}
image_name=dev.registry.pivotal.io/navcon/deplab-test-asset:${filename/Dockerfile./}

docker build . -f $filename -t ${image_name}
docker push ${image_name}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/additional_source_url_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var _ = Describe("deplab additional-source-url", func() {
)

JustBeforeEach(func() {
metadataLabel = runDeplabAgainstTar(getTestAssetPath("tiny.tgz"), additionalArguments...)
metadataLabel = runDeplabAgainstTar(getTestAssetPath("image-archives/tiny.tgz"), additionalArguments...)
})

Context("when I supply only one --additional-source-url argument", func() {
Expand Down
30 changes: 15 additions & 15 deletions test/integration/additional_sources_file_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ = Describe("deplab additional sources file", func() {
)

JustBeforeEach(func() {
metadataLabel = runDeplabAgainstTar(getTestAssetPath("tiny.tgz"), additionalArguments...)
metadataLabel = runDeplabAgainstTar(getTestAssetPath("image-archives/tiny.tgz"), additionalArguments...)
})

Context("and it only has one source archive", func() {
Expand Down Expand Up @@ -90,7 +90,7 @@ var _ = Describe("deplab additional sources file", func() {

Context("with no source archive urls", func() {
BeforeEach(func() {
additionalArguments = []string{"--additional-sources-file", getTestAssetPath("sources-file-empty-archives.yml")}
additionalArguments = []string{"--additional-sources-file", getTestAssetPath("sources/sources-file-empty-archives.yml")}
})

It("adds zero archive entries", func() {
Expand All @@ -101,7 +101,7 @@ var _ = Describe("deplab additional sources file", func() {

Context("with only one vcs", func() {
BeforeEach(func() {
additionalArguments = []string{"--additional-sources-file", getTestAssetPath("sources-file-single-vcs.yml")}
additionalArguments = []string{"--additional-sources-file", getTestAssetPath("sources/sources-file-single-vcs.yml")}
})

It("adds a git dependency", func() {
Expand Down Expand Up @@ -189,7 +189,7 @@ var _ = Describe("deplab additional sources file", func() {
It("exits with an error", func() {
_, stdErr := runDepLab([]string{
"--additional-sources-file", "erroneous_path.yml",
"--image-tar", getTestAssetPath("tiny.tgz"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--metadata-file", "doesnotmatter1",
}, 1)
Expand All @@ -202,8 +202,8 @@ var _ = Describe("deplab additional sources file", func() {
Context("with an empty file", func() {
It("exits with an error", func() {
_, stdErr := runDepLab([]string{
"--additional-sources-file", getTestAssetPath("empty-file.yml"),
"--image-tar", getTestAssetPath("tiny.tgz"),
"--additional-sources-file", getTestAssetPath("sources/empty-file.yml"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--metadata-file", "doesnotmatter2",
}, 1)
Expand All @@ -215,8 +215,8 @@ var _ = Describe("deplab additional sources file", func() {
Context("with a unsupported vcs type", func() {
It("exits with an error", func() {
_, stdErr := runDepLab([]string{
"--additional-sources-file", getTestAssetPath("sources-unsupported-vcs.yml"),
"--image-tar", getTestAssetPath("tiny.tgz"),
"--additional-sources-file", getTestAssetPath("sources/sources-unsupported-vcs.yml"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--metadata-file", "doesnotmatter3",
}, 1)
Expand All @@ -228,8 +228,8 @@ var _ = Describe("deplab additional sources file", func() {
Context("with a invalid file extension", func() {
It("exits with an error", func() {
_, stdErr := runDepLab([]string{
"--additional-sources-file", getTestAssetPath("sources-file-unsupported-extension.yml"),
"--image-tar", getTestAssetPath("tiny.tgz"),
"--additional-sources-file", getTestAssetPath("sources/sources-file-unsupported-extension.yml"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--metadata-file", "doesnotmatter4",
}, 1)
Expand All @@ -241,8 +241,8 @@ var _ = Describe("deplab additional sources file", func() {
Context("with an invalid git url", func() {
It("exits with an error", func() {
_, stdErr := runDepLab([]string{
"--additional-sources-file", getTestAssetPath("sources-invalid-git-url.yml"),
"--image-tar", getTestAssetPath("tiny.tgz"),
"--additional-sources-file", getTestAssetPath("sources/sources-invalid-git-url.yml"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--metadata-file", "doesnotmatter5",
}, 1)
Expand All @@ -261,8 +261,8 @@ var _ = Describe("deplab additional sources file", func() {
defer os.Remove(f.Name())

_, stdErr := runDepLab([]string{
"--additional-sources-file", getTestAssetPath("sources-invalid-git-url.yml"),
"--image-tar", getTestAssetPath("tiny.tgz"),
"--additional-sources-file", getTestAssetPath("sources/sources-invalid-git-url.yml"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--metadata-file", f.Name(),
"--ignore-validation-errors",
Expand Down Expand Up @@ -303,7 +303,7 @@ func selectVcsGitDependencies(dependencies []metadata.Dependency) []metadata.Dep
}

func templateAdditionalSource(path, server string) string {
inputAdditionalSourcesPath, err := filepath.Abs(filepath.Join("assets", path))
inputAdditionalSourcesPath, err := filepath.Abs(filepath.Join("assets", "sources", path))
Expect(err).ToNot(HaveOccurred())

t, err := template.ParseFiles(inputAdditionalSourcesPath)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM cloudfoundry/run:tiny

LABEL "io.pivotal.metadata"="invalidjson"
4 changes: 2 additions & 2 deletions test/integration/base_image_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ var _ = Describe("deplab", func() {

Expect(metadataLabel.Base).To(SatisfyAll(matchers...))
},
Entry("ubuntu:bionic image", "os-release-on-scratch.tgz",
Entry("ubuntu:bionic image os-release", "image-archives/os-release-on-scratch.tgz",
HaveKeyWithValue("name", "Ubuntu"),
HaveKeyWithValue("version", "18.04.3 LTS (Bionic Beaver)"),
HaveKeyWithValue("version_id", "18.04"),
HaveKeyWithValue("id_like", "debian"),
HaveKeyWithValue("version_codename", "bionic"),
HaveKeyWithValue("pretty_name", "Ubuntu 18.04.3 LTS"),
),
Entry("an image that doesn't have an os-release", "all-file-types.tgz",
Entry("an image that doesn't have an os-release", "image-archives/all-file-types.tgz",
HaveKeyWithValue("name", "unknown"),
HaveKeyWithValue("version_codename", "unknown"),
HaveKeyWithValue("version_id", "unknown"),
Expand Down
12 changes: 6 additions & 6 deletions test/integration/deplab_flag_validation_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var _ = Describe("deplab", func() {
It("exits with an error if neither metadata-file, dpkg-list, output-tar flags are set", func() {
_, stdErr := runDepLab([]string{
"--git", pathToGitRepo,
"--image-tar", getTestAssetPath("tiny.tgz"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
}, 1)

errorOutput := strings.TrimSpace(string(getContentsOfReader(stdErr)))
Expand Down Expand Up @@ -90,7 +90,7 @@ var _ = Describe("deplab", func() {

It("exits with an error if additional-source-url is not valid", func() {
_, stdErr := runDepLab([]string{
"--image-tar", getTestAssetPath("tiny.tgz"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--metadata-file", "doesnotmatter12",
"--additional-source-url", "/foo/bar",
Expand All @@ -105,7 +105,7 @@ var _ = Describe("deplab", func() {

It("exits with an error if additional-source-url is not reachable ", func() {
_, stdErr := runDepLab([]string{
"--image-tar", getTestAssetPath("tiny.tgz"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--metadata-file", "doesnotmatter13",
"--additional-source-url", "https://package.some.invalid/cool-package",
Expand All @@ -125,7 +125,7 @@ var _ = Describe("deplab", func() {
address := server.URL() + "/cool-package"

_, stdErr := runDepLab([]string{
"--image-tar", getTestAssetPath("tiny.tgz"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--additional-source-url", address,
"--metadata-file", "doesnotmatter14",
Expand All @@ -146,7 +146,7 @@ var _ = Describe("deplab", func() {
defer os.Remove(d)

_, stdErr := runDepLab([]string{
"--image-tar", getTestAssetPath("tiny.tgz"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--additional-source-url", "/foo/bar",
"--metadata-file", metadataFileName,
Expand Down Expand Up @@ -181,7 +181,7 @@ var _ = Describe("deplab", func() {
}

_, stdErr := runDepLab([]string{
"--image-tar", getTestAssetPath("tiny.tgz"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--additional-source-url", addresses[0],
"--additional-source-url", addresses[1],
Expand Down
4 changes: 2 additions & 2 deletions test/integration/dpkg_file_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var _ = Describe("deplab", func() {
defer test_utils.CleanupFile(dpkgDestinationPath)

_ = runDeplabAgainstTar(
getTestAssetPath("tiny.tgz"),
getTestAssetPath("image-archives/tiny.tgz"),
"--dpkg-file",
dpkgDestinationPath)

Expand All @@ -37,7 +37,7 @@ var _ = Describe("deplab", func() {
Describe("and metadata can't be written", func() {
It("writes the image metadata, returns the sha and throws an error about the file missing", func() {
_, stdErr := runDepLab([]string{
"--image-tar", getTestAssetPath("tiny.tgz"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", pathToGitRepo,
"--dpkg-file", "a-path-that-does-not-exist/foo.dpkg",
}, 1)
Expand Down
10 changes: 5 additions & 5 deletions test/integration/dpkg_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var _ = Describe("deplab dpkg", func() {

Context("with an ubuntu:bionic image", func() {
BeforeEach(func() {
metadataLabel = runDeplabAgainstImage("pivotalnavcon/test-asset-additional-sources")
metadataLabel = runDeplabAgainstImage("dev.registry.pivotal.io/navcon/deplab-test-asset:additional-sources")
})

It("applies a metadata label", func() {
Expand Down Expand Up @@ -61,7 +61,7 @@ var _ = Describe("deplab dpkg", func() {

Context("with an image without dpkg", func() {
It("does not return a dpkg list", func() {
metadataLabel = runDeplabAgainstTar(getTestAssetPath("all-file-types.tgz"))
metadataLabel = runDeplabAgainstTar(getTestAssetPath("image-archives/all-file-types.tgz"))

_, ok := filterDpkgDependency(metadataLabel.Dependencies)
Expect(ok).To(BeFalse())
Expand All @@ -70,7 +70,7 @@ var _ = Describe("deplab dpkg", func() {

Context("with an image with dpkg, but no apt sources", func() {
BeforeEach(func() {
metadataLabel = runDeplabAgainstImage("pivotalnavcon/test-asset-no-sources")
metadataLabel = runDeplabAgainstImage("dev.registry.pivotal.io/navcon/deplab-test-asset:no-sources")
})

It("does not return a dpkg list", func() {
Expand All @@ -86,7 +86,7 @@ var _ = Describe("deplab dpkg", func() {

Context("with an ubuntu:bionic based image with a non-shell entrypoint", func() {
BeforeEach(func() {
metadataLabel = runDeplabAgainstImage("pivotalnavcon/test-asset-entrypoint-return-stdout")
metadataLabel = runDeplabAgainstImage("dev.registry.pivotal.io/navcon/deplab-test-asset:entrypoint-return-stdout")
})

It("should return the apt source list", func() {
Expand All @@ -103,7 +103,7 @@ var _ = Describe("deplab dpkg", func() {

Context("with Pivotal Tiny", func() {
BeforeEach(func() {
metadataLabel = runDeplabAgainstTar(getTestAssetPath("tiny.tgz"))
metadataLabel = runDeplabAgainstTar(getTestAssetPath("image-archives/tiny.tgz"))
})

It("returns a dpkg list", func() {
Expand Down
6 changes: 3 additions & 3 deletions test/integration/git_integation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var _ = Describe("deplab git", func() {
)

JustBeforeEach(func() {
metadataLabel = runDeplabAgainstTar(getTestAssetPath("tiny.tgz"), additionalArguments...)
metadataLabel = runDeplabAgainstTar(getTestAssetPath("image-archives/tiny.tgz"), additionalArguments...)
gitDependencies = selectGitDependencies(metadataLabel.Dependencies)
})

Expand Down Expand Up @@ -72,7 +72,7 @@ var _ = Describe("deplab git", func() {
It("exits with an error message", func() {
By("executing it")
_, stdErr := runDepLab([]string{
"--image-tar", getTestAssetPath("tiny.tgz"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--git", "/dev/null",
"--metadata-file", "doesnotmatter6",
}, 1)
Expand All @@ -89,7 +89,7 @@ var _ = Describe("deplab git", func() {
defer os.Remove(d)
Expect(err).To(Not(HaveOccurred()))
_, stdErr := runDepLab([]string{
"--image-tar", getTestAssetPath("tiny.tgz"),
"--image-tar", getTestAssetPath("image-archives/tiny.tgz"),
"--metadata-file", metadatafileName,
}, 1)

Expand Down
4 changes: 2 additions & 2 deletions test/integration/input_tar_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var _ = Describe("deplab", func() {
Context("with an image tar path", func() {
It("labels the image", func() {
By("executing it")
metadataLabel := runDeplabAgainstTar(getTestAssetPath("tiny.tgz"))
metadataLabel := runDeplabAgainstTar(getTestAssetPath("image-archives/tiny.tgz"))

gitDependencies := selectGitDependencies(metadataLabel.Dependencies)
gitDependency := gitDependencies[0]
Expand Down Expand Up @@ -44,7 +44,7 @@ var _ = Describe("deplab", func() {
Context("with an image tar with a eu.gcr.io tag", func() {
It("labels the image", func() {
By("executing it")
metadataLabel := runDeplabAgainstTar(getTestAssetPath("tiny-with-eu.gcr.io-tag.tar"))
metadataLabel := runDeplabAgainstTar(getTestAssetPath("image-archives/tiny-with-eu.gcr.io-tag.tar"))

gitDependencies := selectGitDependencies(metadataLabel.Dependencies)
gitDependency := gitDependencies[0]
Expand Down
12 changes: 6 additions & 6 deletions test/integration/inspect_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ var _ = Describe("deplab inspect", func() {
Expect(err).ToNot(HaveOccurred())
Expect(md.Provenance[0].Name).To(Equal("deplab"))
},
Entry("with a deplab'd image tarball", "--image-tar", getTestAssetPath("tiny-deplabd.tgz")),
Entry("with a deplab'd image from a registry", "--image", "pivotalnavcon/test-asset-tiny-deplabd"),
Entry("with a deplab'd image tarball", "--image-tar", getTestAssetPath("image-archives/tiny-deplabd.tgz")),
Entry("with a deplab'd image from a registry", "--image", "dev.registry.pivotal.io/navcon/deplab-test-asset:tiny-deplabd"),
)

DescribeTable("provides an error", func(flag, path, errorMsg string) {
Expand All @@ -65,11 +65,11 @@ var _ = Describe("deplab inspect", func() {
ContainSubstring(errorMsg),
ContainSubstring(path)))
},
Entry("with a undeplab'd image tar path", "--image-tar", getTestAssetPath("tiny.tgz"), "deplab cannot find the 'io.pivotal.metadata' label on the provided image"),
Entry("with a undeplab'd image tar path", "--image-tar", getTestAssetPath("image-archives/tiny.tgz"), "deplab cannot find the 'io.pivotal.metadata' label on the provided image"),
Entry("with a undeplab'd image from a registry", "--image", "cloudfoundry/run:tiny", "deplab cannot find the 'io.pivotal.metadata' label on the provided image"),
Entry("with a invalid image tarball", "--image-tar", getTestAssetPath("invalid-image-archive.tgz"), "deplab cannot open the provided image"),
Entry("with a invalid image tarball", "--image-tar", getTestAssetPath("image-archives/invalid-image-archive.tgz"), "deplab cannot open the provided image"),
Entry("with a non-existent image from registry", "--image", "pivotalnavcon/does-not-exist", "deplab cannot retrieve the Config file"),
Entry("with a valid image tar ball with invalid json label", "--image-tar", getTestAssetPath("tiny-with-invalid-label.tgz"), "deplab cannot parse the label"),
Entry("with a valid image from a registry with invalid json label", "--image", "pivotalnavcon/test-asset-tiny-with-invalid-label", "deplab cannot parse the label"),
Entry("with a valid image tar ball with invalid json label", "--image-tar", getTestAssetPath("image-archives/tiny-with-invalid-label.tgz"), "deplab cannot parse the label"),
Entry("with a valid image from a registry with invalid json label", "--image", "dev.registry.pivotal.io/navcon/deplab-test-asset:tiny-with-invalid-label", "deplab cannot parse the label"),
)
})
Loading

0 comments on commit f3eb0c8

Please sign in to comment.