Skip to content

Commit 37f3f47

Browse files
authored
Merge branch 'main' into fixed-add-image-logs
2 parents 0489d57 + 243671f commit 37f3f47

3 files changed

Lines changed: 71 additions & 60 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,20 @@ jobs:
216216
- name: Verify - hauler store copy
217217
run: |
218218
hauler store copy --help
219-
# need more tests here
219+
# verify via registry target
220+
hauler store serve registry --port 5002 --readonly=false &
221+
until curl -sf http://localhost:5002/v2/_catalog; do : ; done
222+
hauler store copy registry://localhost:5002 --plain-http
223+
# verify blobs actually landed in the registry backend
224+
[ $(find registry -type f | wc -l) -gt 0 ]
225+
# verify via --only
226+
hauler store copy registry://localhost:5002 --plain-http --only busybox
227+
pkill -f "hauler store serve registry --port 5002"
228+
rm -rf registry
229+
# verify via directory target (files and charts only; images and cosign artifacts are skipped)
230+
hauler store copy dir://./store-copy-output
231+
test -f ./store-copy-output/hauler-manifest.yaml
232+
rm -rf ./store-copy-output
220233
221234
- name: Verify - hauler store extract
222235
run: |
@@ -354,9 +367,9 @@ jobs:
354367
until curl -sf http://localhost:5001/v2/_catalog; do : ; done
355368
pkill -f "hauler store serve registry --port 5001 --readonly"
356369
# verify via registry with different port with readonly with tls
357-
# hauler store serve registry --port 5001 --readonly --tls-cert testdata/certs/server-cert.crt --tls-key testdata/certs/server-cert.key &
358-
# until curl -sf --cacert testdata/certs/cacerts.pem https://localhost:5001/v2/_catalog; do : ; done
359-
# pkill -f "hauler store serve registry --port 5001 --readonly --tls-cert testdata/certs/server-cert.crt --tls-key testdata/certs/server-cert.key"
370+
hauler store serve registry --port 5001 --readonly --tls-cert testdata/certs/server-cert.crt --tls-key testdata/certs/server-cert.key &
371+
until curl -sf --cacert testdata/certs/cacerts.pem https://localhost:5001/v2/_catalog; do : ; done
372+
pkill -f "hauler store serve registry --port 5001 --readonly --tls-cert testdata/certs/server-cert.crt --tls-key testdata/certs/server-cert.key"
360373
361374
- name: Verify - hauler store serve fileserver
362375
run: |
@@ -374,9 +387,9 @@ jobs:
374387
until curl -sf http://localhost:8000; do : ; done
375388
pkill -f "hauler store serve fileserver --port 8000 --timeout 120"
376389
# verify via fileserver with different port with timeout and tls
377-
# hauler store serve fileserver --port 8000 --timeout 120 --tls-cert testdata/certs/server-cert.crt --tls-key testdata/certs/server-cert.key &
378-
# until curl -sf --cacert testdata/certs/cacerts.pem https://localhost:8000; do : ; done
379-
# pkill -f "hauler store serve fileserver --port 8000 --timeout 120 --tls-cert testdata/certs/server-cert.crt --tls-key testdata/certs/server-cert.key"
390+
hauler store serve fileserver --port 8000 --timeout 120 --tls-cert testdata/certs/server-cert.crt --tls-key testdata/certs/server-cert.key &
391+
until curl -sf --cacert testdata/certs/cacerts.pem https://localhost:8000; do : ; done
392+
pkill -f "hauler store serve fileserver --port 8000 --timeout 120 --tls-cert testdata/certs/server-cert.crt --tls-key testdata/certs/server-cert.key"
380393
381394
- name: Verify Hauler Store Contents
382395
run: |

cmd/hauler/cli/store.go

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ func addStoreCopy(rso *flags.StoreRootOpts, ro *flags.CliRootOpts) *cobra.Comman
310310
Use: "copy",
311311
Short: "Copy all store content to another location",
312312
Example: ` # supported copy target prefixes
313-
registry:// | reg:// | oci:// - Pushes the store to an OCI registry
314-
directory:// | dir:// - Extracts the store to a directory`,
313+
registry:// | reg:// | oci:// - Pushes the store to an OCI registry
314+
directory:// | dir:// - Extracts the store to a directory`,
315315
Args: cobra.ExactArgs(1),
316316
RunE: func(cmd *cobra.Command, args []string) error {
317317
ctx := cmd.Context()
@@ -354,13 +354,13 @@ func addStoreAddFile(rso *flags.StoreRootOpts, ro *flags.CliRootOpts) *cobra.Com
354354
Use: "file",
355355
Short: "Add a file to the store",
356356
Example: ` # fetch local file
357-
hauler store add file file.txt
357+
hauler store add file file.txt
358358
359-
# fetch remote file
360-
hauler store add file https://get.rke2.io/install.sh
359+
# fetch remote file
360+
hauler store add file https://get.rke2.io/install.sh
361361
362-
# fetch remote file and assign new name
363-
hauler store add file https://get.hauler.dev --name hauler-install.sh`,
362+
# fetch remote file and assign new name
363+
hauler store add file https://get.hauler.dev --name hauler-install.sh`,
364364
Args: cobra.ExactArgs(1),
365365
RunE: func(cmd *cobra.Command, args []string) error {
366366
ctx := cmd.Context()
@@ -384,27 +384,27 @@ func addStoreAddImage(rso *flags.StoreRootOpts, ro *flags.CliRootOpts) *cobra.Co
384384
cmd := &cobra.Command{
385385
Use: "image",
386386
Short: "Add a image to the store",
387-
Example: ` # fetch image
388-
hauler store add image busybox
387+
Example: ` # fetch image
388+
hauler store add image busybox
389389
390-
# fetch image with repository and tag
391-
hauler store add image library/busybox:stable
390+
# fetch image with repository and tag
391+
hauler store add image library/busybox:stable
392392
393-
# fetch image with full image reference and specific platform
394-
hauler store add image ghcr.io/hauler-dev/hauler-debug:v1.2.0 --platform linux/amd64
393+
# fetch image with full image reference and specific platform
394+
hauler store add image ghcr.io/hauler-dev/hauler-debug:v1.2.0 --platform linux/amd64
395395
396-
# fetch image with full image reference via digest
397-
hauler store add image gcr.io/distroless/base@sha256:7fa7445dfbebae4f4b7ab0e6ef99276e96075ae42584af6286ba080750d6dfe5
396+
# fetch image with full image reference via digest
397+
hauler store add image gcr.io/distroless/base@sha256:7fa7445dfbebae4f4b7ab0e6ef99276e96075ae42584af6286ba080750d6dfe5
398398
399-
# fetch image with full image reference, specific platform, and signature verification
400-
curl -sfOL https://raw.githubusercontent.com/rancherfederal/carbide-releases/main/carbide-key.pub
401-
hauler store add image rgcrprod.azurecr.us/rancher/rke2-runtime:v1.31.5-rke2r1 --platform linux/amd64 --key carbide-key.pub
399+
# fetch image with full image reference, specific platform, and signature verification
400+
curl -sfOL https://raw.githubusercontent.com/rancherfederal/carbide-releases/main/carbide-key.pub
401+
hauler store add image rgcrprod.azurecr.us/rancher/rke2-runtime:v1.31.5-rke2r1 --platform linux/amd64 --key carbide-key.pub
402402
403-
# fetch image and rewrite path
404-
hauler store add image busybox --rewrite custom-path/busybox:latest
403+
# fetch image and rewrite path
404+
hauler store add image busybox --rewrite custom-path/busybox:latest
405405
406-
# add image from local Docker daemon
407-
hauler store add image my-local-app:latest --local`,
406+
# add image from local Docker daemon
407+
hauler store add image my-local-app:latest --local`,
408408
Args: cobra.ExactArgs(1),
409409
PreRunE: func(cmd *cobra.Command, args []string) error {
410410
// Check for ca-file & insecure-skip-tls-verify env variables
@@ -441,26 +441,26 @@ func addStoreAddChart(rso *flags.StoreRootOpts, ro *flags.CliRootOpts) *cobra.Co
441441
cmd := &cobra.Command{
442442
Use: "chart",
443443
Short: "Add a helm chart to the store",
444-
Example: ` # fetch local helm chart
445-
hauler store add chart path/to/chart/directory --repo .
444+
Example: ` # fetch local helm chart
445+
hauler store add chart path/to/chart/directory --repo .
446446
447-
# fetch local compressed helm chart
448-
hauler store add chart path/to/chart.tar.gz --repo .
447+
# fetch local compressed helm chart
448+
hauler store add chart path/to/chart.tar.gz --repo .
449449
450-
# fetch remote oci helm chart
451-
hauler store add chart hauler-helm --repo oci://ghcr.io/hauler-dev
450+
# fetch remote oci helm chart
451+
hauler store add chart hauler-helm --repo oci://ghcr.io/hauler-dev
452452
453-
# fetch remote oci helm chart with version
454-
hauler store add chart hauler-helm --repo oci://ghcr.io/hauler-dev --version 1.2.0
453+
# fetch remote oci helm chart with version
454+
hauler store add chart hauler-helm --repo oci://ghcr.io/hauler-dev --version 1.2.0
455455
456-
# fetch remote helm chart
457-
hauler store add chart rancher --repo https://releases.rancher.com/server-charts/stable
456+
# fetch remote helm chart
457+
hauler store add chart rancher --repo https://releases.rancher.com/server-charts/stable
458458
459-
# fetch remote helm chart with specific version
460-
hauler store add chart rancher --repo https://releases.rancher.com/server-charts/latest --version 2.10.1
459+
# fetch remote helm chart with specific version
460+
hauler store add chart rancher --repo https://releases.rancher.com/server-charts/latest --version 2.10.1
461461
462-
# fetch remote helm chart and rewrite path
463-
hauler store add chart hauler-helm --repo oci://ghcr.io/hauler-dev --rewrite custom-path/hauler-chart:latest`,
462+
# fetch remote helm chart and rewrite path
463+
hauler store add chart hauler-helm --repo oci://ghcr.io/hauler-dev --rewrite custom-path/hauler-chart:latest`,
464464
Args: cobra.ExactArgs(1),
465465
PreRunE: func(cmd *cobra.Command, args []string) error {
466466
n, err := flags.ResolveConcurrency(cmd.Flags().Changed("concurrency"), o.Concurrency)
@@ -502,25 +502,25 @@ func addStoreRemove(rso *flags.StoreRootOpts, ro *flags.CliRootOpts) *cobra.Comm
502502
Use: "remove <artifact-ref>",
503503
Short: "Remove an artifact from the content store",
504504
Example: ` # remove an image using full store reference
505-
hauler store info
506-
hauler store remove index.docker.io/library/busybox:stable
505+
hauler store info
506+
hauler store remove index.docker.io/library/busybox:stable
507507
508-
# remove a chart using full store reference
509-
hauler store info
510-
hauler store remove hauler/rancher:2.8.4
508+
# remove a chart using full store reference
509+
hauler store info
510+
hauler store remove hauler/rancher:2.8.4
511511
512-
# remove a file using full store reference
513-
hauler store info
514-
hauler store remove hauler/rke2-install.sh
512+
# remove a file using full store reference
513+
hauler store info
514+
hauler store remove hauler/rke2-install.sh
515515
516-
# remove any artifact with the latest tag
517-
hauler store remove :latest
516+
# remove any artifact with the latest tag
517+
hauler store remove :latest
518518
519-
# remove any artifact with 'busybox' in the reference
520-
hauler store remove busybox
519+
# remove any artifact with 'busybox' in the reference
520+
hauler store remove busybox
521521
522-
# force remove without verification
523-
hauler store remove busybox:latest --force`,
522+
# force remove without verification
523+
hauler store remove busybox:latest --force`,
524524
Args: cobra.ExactArgs(1),
525525
RunE: func(cmd *cobra.Command, args []string) error {
526526
ctx := cmd.Context()

testdata/certificate-script.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
set -e
3+
set -ex
44

55
# setup directories
66
mkdir -p testdata/certs
@@ -32,7 +32,6 @@ CN = CERTIFICATE AUTHORITY CERTIFICATE
3232
3333
[v3_ca]
3434
keyUsage = critical, keyCertSign, cRLSign
35-
extendedKeyUsage = anyExtendedKeyUsage
3635
basicConstraints = critical, CA:TRUE
3736
EOF
3837

@@ -71,7 +70,6 @@ CN = INTERMEDIARY CERTIFICATE AUTHORITY CERTIFICATE
7170
7271
[v3_ca]
7372
keyUsage = critical, keyCertSign, cRLSign
74-
extendedKeyUsage = anyExtendedKeyUsage
7573
basicConstraints = critical, CA:TRUE
7674
EOF
7775

0 commit comments

Comments
 (0)