Skip to content

Bug: stacker does not notice import file changed #530

Description

@smoser

stacker version

v1.0.0-rc5-396ff9d liblxc cb8e38aca27a23964941f0f011a8919aab8bebab

Describe the bug

When using import with a destination, stacker does not realize that a imported file has changed and re-build the content.

demo:
  from:
    type: docker
    url: ${{IMAGE:docker://busybox:latest}}
  import:
    - path: import1.txt
      dest: /imports/
  run: |
    #!/bin/sh -e
    read line < /imports/import1.txt
    echo "read $line"

Given the above stacker.yaml, run stacker build once, change the content of 'import1.txt' and then run it again. Expectation is that the build would be redone.

To reproduce

I am attaching a script to automate the testing.
stacker-test.sh.txt

Expected behavior

Build should occur a second time, after import1.txt content is changed and log should contain output showing that it built.

Screenshots

Example output

$ PATH=$PWD:$PATH ../stacker-test.sh
execute: stacker --version
stacker version stacker v1.0.0-rc5-396ff9d liblxc cb8e38aca27a23964941f0f011a8919aab8bebab
using cached busybox:latest in oci:stacker-test-imgcache:busybox:latest
# clean up any previous state.
execute: rm -Rf stacker-test.d stacker-test.log.1 stacker-test.log.2 import1.txt

# Write FIRST-BUILD to import1.txt and build

Updated import1.txt with 'FIRST-BUILD'
execute: stacker --work-dir=stacker-test.d build --stacker-file=stacker-test.yaml --substitute=IMAGE=oci:stacker-test-imgcache:busybox:latest
preparing image demo...
copying /tmp/dd/import1.txt
loading oci:stacker-test-imgcache:busybox:latest
--------- read FIRST-BUILD ---------
filesystem demo built successfully

execute: grep -q FIRST-BUILD stacker-test.log.1
found FIRST-BUILD in stacker-test.log.1

# Now update import1.txt with SECOND-BUILD and re-build

Updated import1.txt with 'SECOND-BUILD'
execute: stacker --work-dir=stacker-test.d build --stacker-file=stacker-test.yaml --substitute=IMAGE=oci:stacker-test-imgcache:busybox:latest
preparing image demo...
copying /tmp/dd/import1.txt
loading oci:stacker-test-imgcache:busybox:latest
found cached layer demo
execute: grep -q SECOND-BUILD stacker-test.log.2
FAIL: no occurance of "SECOND-BUILD" in log.2

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions