diff --git a/test/basic.bats b/test/basic.bats index 70414df9..63258c7d 100644 --- a/test/basic.bats +++ b/test/basic.bats @@ -14,7 +14,7 @@ busybox: from: type: oci url: $BUSYBOX_OCI - import: import + imports: import EOF echo 1 > import stacker build @@ -32,7 +32,7 @@ busybox: from: type: tar url: .stacker/layer-bases/busybox.tar - import: + imports: - ./stacker.yaml - https://www.cisco.com/favicon.ico - ./executable @@ -199,6 +199,7 @@ busybox: type: tar url: .stacker/layer-bases/busybox.tar import: + imports: - ./stacker.yaml - https://www.cisco.com/favicon.ico - ./executable diff --git a/test/broken-link.bats b/test/broken-link.bats index a43391b7..c26d400f 100644 --- a/test/broken-link.bats +++ b/test/broken-link.bats @@ -15,7 +15,7 @@ broken_link: from: type: oci url: $BUSYBOX_OCI - import: + imports: - dir run: cp -a /stacker/imports/dir/testln /testln EOF diff --git a/test/build-only.bats b/test/build-only.bats index 3d251d04..5e219931 100644 --- a/test/build-only.bats +++ b/test/build-only.bats @@ -83,7 +83,7 @@ busybox: from: type: oci url: $BUSYBOX_OCI - import: https://www.cisco.com/favicon.ico + imports: https://www.cisco.com/favicon.ico run: | cp /stacker/imports/favicon.ico /favicon.ico build_only: true @@ -91,7 +91,7 @@ layer1: from: type: built tag: busybox - import: + imports: - stacker://busybox/favicon.ico run: - cp /stacker/imports/favicon.ico /favicon2.ico @@ -108,7 +108,7 @@ busybox: from: type: oci url: $BUSYBOX_OCI - import: https://www.cisco.com/favicon.ico + imports: https://www.cisco.com/favicon.ico run: | cp /stacker/imports/favicon.ico /favicon.ico build_only: true @@ -116,7 +116,7 @@ layer1: from: type: built tag: busybox - import: + imports: - stacker://busybox/favicon.ico run: - cp /stacker/imports/favicon.ico /favicon2.ico diff --git a/test/caching.bats b/test/caching.bats index 8c5bd09f..55e00006 100644 --- a/test/caching.bats +++ b/test/caching.bats @@ -52,7 +52,7 @@ base: from: type: built tag: build-base - import: + imports: - foo run: | cp /stacker/imports/foo /foo @@ -71,7 +71,7 @@ import-cache: from: type: oci url: $BUSYBOX_OCI - import: + imports: - link/foo run: cp /stacker/imports/foo/zomg /zomg EOF @@ -95,7 +95,7 @@ a: from: type: oci url: $BUSYBOX_OCI - import: + imports: - foo run: | [ -f /stacker/imports/foo/bar ] @@ -111,7 +111,7 @@ a: from: type: oci url: $BUSYBOX_OCI - import: + imports: - foo run: | [ ! -f /stacker/imports/foo/bar ] @@ -126,7 +126,7 @@ bind-test: from: type: oci url: ${{BUSYBOX_OCI}} - import: + imports: - tree1/foo/zomg binds: - ${{bind_path}} -> /root/tree2/foo @@ -169,7 +169,7 @@ mode-test: from: type: oci url: $BUSYBOX_OCI - import: + imports: - executable run: cp /stacker/imports/executable /executable EOF @@ -185,6 +185,7 @@ EOF } @test "can read previous version's cache" { + skip "old version does not support imports (plural) directive" # some additional testing that the cache can be read by older versions of # stacker (cache_test.go has the full test for the type, this just checks # the mechanics of filepaths and such) @@ -204,7 +205,7 @@ test: from: type: oci url: $BUSYBOX_OCI - import: + imports: - foo run: cp /stacker/imports/foo /foo EOF diff --git a/test/cp-not-required.bats b/test/cp-not-required.bats index 137f9689..ad935dc5 100644 --- a/test/cp-not-required.bats +++ b/test/cp-not-required.bats @@ -27,7 +27,7 @@ contents2: from: type: built tag: build - import: + imports: - stacker://contents/first - stacker://contents/second run: | diff --git a/test/dependency-order.bats b/test/dependency-order.bats index 202f24cc..b38df731 100644 --- a/test/dependency-order.bats +++ b/test/dependency-order.bats @@ -27,7 +27,7 @@ test: from: type: oci tag: $BUSYBOX_OCI - import: + imports: - stacker://foo/bar - stacker://baz/foo EOF @@ -74,7 +74,7 @@ installer-iso-build: type: built tag: minbase1 build_only: true - import: + imports: - stacker://installer-initrd/output/installer-initrd-base.cpio - stacker://installer-initrd-modules/output/installer-initrd-modules.cpio run: | diff --git a/test/docker-base.bats b/test/docker-base.bats index b9191ce0..9d2ba0ee 100644 --- a/test/docker-base.bats +++ b/test/docker-base.bats @@ -14,7 +14,7 @@ busybox: from: type: docker url: oci:${BUSYBOX_OCI} - import: + imports: - https://www.cisco.com/favicon.ico run: | cp /stacker/imports/favicon.ico /favicon.ico diff --git a/test/import-http.bats b/test/import-http.bats index f2bbeb7d..09de7f65 100644 --- a/test/import-http.bats +++ b/test/import-http.bats @@ -23,7 +23,7 @@ img: from: type: oci url: $(pwd)/oci:busybox_base - import: + imports: - http://network-test.debian.org/nm run: | cp /stacker/imports/nm /root/nm @@ -79,7 +79,7 @@ busybox_base: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: https://www.cisco.com/favicon.ico dest: /dest/icon run: | diff --git a/test/import.bats b/test/import.bats index 629e1784..132a8d9f 100644 --- a/test/import.bats +++ b/test/import.bats @@ -15,7 +15,7 @@ thing: from: type: oci url: $BUSYBOX_OCI - import: + imports: - https://bing.com/favicon.ico EOF stacker build @@ -35,7 +35,7 @@ busybox: from: type: oci url: $BUSYBOX_OCI - import: + imports: - recursive run: | [ -d /stacker/imports/recursive ] @@ -53,7 +53,7 @@ first: from: type: oci url: $BUSYBOX_OCI - import: + imports: - recursive run: | [ -d /stacker/imports/recursive ] @@ -63,7 +63,7 @@ second: from: type: oci url: $BUSYBOX_OCI - import: + imports: - stacker://first/recursive run: | [ -d /stacker/imports/recursive ] @@ -82,7 +82,7 @@ first: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: test_file hash: $test_file_sha - test_file2 @@ -96,7 +96,7 @@ second: from: type: built tag: first - import: + imports: - path: stacker://first/test_file hash: $test_file_sha run: | @@ -113,7 +113,7 @@ busybox: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: test_file hash: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b856 EOF @@ -128,7 +128,7 @@ busybox: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: test_file hash: 1234abcdef EOF @@ -145,7 +145,7 @@ first: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: test_file hash: $test_file_sha run: | @@ -155,7 +155,7 @@ second: from: type: built tag: first - import: + imports: - path: stacker://first/test_file hash: $test_file_sha_upper run: | @@ -173,7 +173,7 @@ thing: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: https://www.google.com/favicon.ico hash: $google_sha run: | @@ -190,7 +190,7 @@ thing: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: https://www.google.com/favicon.ico hash: 0d4856785d1d3c3aad3e5311e654c70c19d335f927c24ebb89dfcd52b2d988cb EOF @@ -209,7 +209,7 @@ thing: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: https://www.google.com/favicon.ico hash: $google_sha - path: test_file @@ -232,7 +232,7 @@ thing: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: https://www.google.com/favicon.ico - path: test_file hash: $test_file_sha @@ -250,7 +250,7 @@ thing: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: https://www.google.com/favicon.ico hash: $google_sha - path: test_file @@ -265,7 +265,7 @@ busybox: from: type: oci url: $BUSYBOX_OCI - import: + imports: - "zomg" - - "one" - "two" @@ -279,7 +279,7 @@ busybox: from: type: oci url: $BUSYBOX_OCI - import: + imports: - dir run: | find /stacker @@ -307,7 +307,7 @@ first: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: test_file hash: $test_file_sha - test_file2 @@ -321,7 +321,7 @@ second: from: type: built tag: first - import: + imports: - path: stacker://first/test_file perms: 0777 hash: $test_file_sha @@ -330,7 +330,7 @@ second: third: from: type: scratch - import: + imports: - path: stacker://first/test_file mode: 0777 hash: $test_file_sha @@ -338,7 +338,7 @@ third: fourth: from: type: scratch - import: + imports: - path: test_file hash: $test_file_sha mode: 0777 @@ -348,7 +348,7 @@ fourth: fifth: from: type: scratch - import: + imports: - path: test_file dest: /files/ - path: test_file2 @@ -357,7 +357,7 @@ sixth: from: type: docker url: oci:${UBUNTU_OCI} - import: + imports: - stacker://fifth/files/test_file - stacker://fifth/file2 run: | @@ -365,7 +365,7 @@ sixth: seventh: from: type: scratch - import: + imports: - path: test_file dest: /files/ - path: test_file2 @@ -376,7 +376,7 @@ eigth: from: type: docker url: oci:${UBUNTU_OCI} - import: + imports: - path: test_file dest: /dir/files/ - path: test_file2 @@ -403,7 +403,7 @@ first: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: folder1/ dest: /folder1/ run: | @@ -422,7 +422,7 @@ third: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: stacker://second/folder1/ dest: /folder1/ run: | @@ -433,7 +433,7 @@ fourth: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: folder1/ dest: / run: | @@ -446,7 +446,7 @@ fifth: from: type: oci url: $BUSYBOX_OCI - import: + imports: - path: folder1/subfolder2/ dest: /folder3/ - path: folder1/subfolder2 @@ -477,7 +477,7 @@ src_folder_dest_non_existent_folder_case1: from: type: docker url: oci:${UBUNTU_OCI} - import: + imports: - path: folder1 dest: /folder2 run: | @@ -487,7 +487,7 @@ src_folder_dest_non_existent_folder_case2: from: type: docker url: oci:${UBUNTU_OCI} - import: + imports: - path: folder1/ dest: /folder2 run: | @@ -497,7 +497,7 @@ src_folder_dest_non_existent_folder_case3: from: type: docker url: oci:${UBUNTU_OCI} - import: + imports: - path: folder1 dest: /folder2/ run: | @@ -509,7 +509,7 @@ src_folder_dest_non_existent_folder_case4: from: type: docker url: oci:${UBUNTU_OCI} - import: + imports: - path: folder1/ dest: /folder2/ run: | @@ -517,3 +517,30 @@ src_folder_dest_non_existent_folder_case4: EOF stacker build } + +@test "legacy imports" { + echo "file1-content" > file1.txt + cat > stacker.yaml <