Skip to content
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

Bug: stacker grab has side-effects creates bin/ #566

Closed
smoser opened this issue Nov 28, 2023 · 0 comments · Fixed by #568
Closed

Bug: stacker grab has side-effects creates bin/ #566

smoser opened this issue Nov 28, 2023 · 0 comments · Fixed by #568
Labels

Comments

@smoser
Copy link
Contributor

smoser commented Nov 28, 2023

stacker version

v1.0.0-rc9

Describe the bug

'stacker grab' creates a 'bin/' directory in the current working directory.

To reproduce

Run the script below, it has output like:

$ bash ./go-test.sh
wrote /tmp/tt/stacker.yaml
$ stacker --work-dir=/tmp/tt/go-test.sh.d build --stacker-file=/tmp/tt/stacker.yaml --substitute=DOCKER_BASE=oci:/tmp/sync-oci.d:
preparing image build...
loading oci:/tmp/sync-oci.d:busybox:latest
Copying blob 3f4d90098f5b done  
Copying config 5ed23df91f done  
Writing manifest to image destination
Storing signatures
+ mkdir /output
+ echo foo
$ rm -Rf grab.d
$ mkdir grab.d
$ cd grab.d
$ stacker --work-dir=/tmp/tt/go-test.sh.d grab build:/output/file1.txt
found extra stuff from grab: tools

go-test.sh is:

#!/bin/bash
fail() { echo "$@" 1>&2; exit 1; }
r() { echo "$" "$@" 1>&2; "$@"; }

b=docker://
[ -d /tmp/sync-oci.d ] && b=oci:/tmp/sync-oci.d:
DOCKER_BASE=${DOCKER_BASE:-$b}

stackerfile="$PWD/stacker.yaml"
workd="$PWD/${0##*/}.d"
cat > "$stackerfile" <<"EOF"
build:
  from:
    type: docker
    url: ${{DOCKER_BASE:docker://}}busybox:latest
  build_only: true
  run: |
    mkdir /output
    echo foo > /output/file1.txt
EOF

echo "wrote $stackerfile" 1>&2
r stacker "--work-dir=$workd" build \
    "--stacker-file=$stackerfile" \
    "--substitute=DOCKER_BASE=${DOCKER_BASE}" ||
    fail "build failed"

r rm -Rf grab.d && r mkdir grab.d || fail "failed creating grab.d"
r cd grab.d || fail "failed cd grab.d"

r stacker "--work-dir=$workd" grab \
    build:/output/file1.txt

extra=""
for f in *; do
    case "$f" in 
        file1.txt) :;;
        *) extra="$extra $f";;
    esac
done

extra=${extra# }
[ -z "$extra" ] || fail "found extra stuff from grab: $extra"
@smoser smoser added the bug label Nov 28, 2023
smoser added a commit to smoser/stacker that referenced this issue Nov 30, 2023
'stacker grab' was creating a 'bin/' dir in the current working
directory.  This fixes that and adds a test to ensure that neither
grab nor build have side effects.

Fixes project-stacker#566.

Signed-off-by: Scott Moser <smoser@brickies.net>
hallyn pushed a commit to smoser/stacker that referenced this issue Jan 8, 2024
'stacker grab' was creating a 'bin/' dir in the current working
directory.  This fixes that and adds a test to ensure that neither
grab nor build have side effects.

Fixes project-stacker#566.

Signed-off-by: Scott Moser <smoser@brickies.net>
Signed-off-by: Serge E. Hallyn <shallyn@cisco.com>
smoser added a commit to smoser/stacker that referenced this issue Jan 9, 2024
'stacker grab' was creating a 'bin/' dir in the current working
directory.  This fixes that and adds a test to ensure that neither
grab nor build have side effects.

Fixes project-stacker#566.

Signed-off-by: Scott Moser <smoser@brickies.net>
smoser added a commit to smoser/stacker that referenced this issue Jan 9, 2024
'stacker grab' was creating a 'bin/' dir in the current working
directory.  This fixes that and adds a test to ensure that neither
grab nor build have side effects.

Fixes project-stacker#566.

Signed-off-by: Scott Moser <smoser@brickies.net>
smoser added a commit to smoser/stacker that referenced this issue Jan 9, 2024
'stacker grab' was creating a 'bin/' dir in the current working
directory.  This fixes that and adds a test to ensure that neither
grab nor build have side effects.

Fixes project-stacker#566.

Signed-off-by: Scott Moser <smoser@brickies.net>
smoser added a commit to smoser/stacker that referenced this issue Jan 12, 2024
'stacker grab' was creating a 'bin/' dir in the current working
directory.  This fixes that and adds a test to ensure that neither
grab nor build have side effects.

Fixes project-stacker#566.

Signed-off-by: Scott Moser <smoser@brickies.net>
smoser added a commit to smoser/stacker that referenced this issue Jan 12, 2024
'stacker grab' was creating a 'bin/' dir in the current working
directory.  This fixes that and adds a test to ensure that neither
grab nor build have side effects.

Fixes project-stacker#566.

Signed-off-by: Scott Moser <smoser@brickies.net>
hallyn pushed a commit that referenced this issue Jan 12, 2024
…568)

'stacker grab' was creating a 'bin/' dir in the current working
directory.  This fixes that and adds a test to ensure that neither
grab nor build have side effects.

Fixes #566.

Signed-off-by: Scott Moser <smoser@brickies.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant