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 does not notice import file changed #530

Open
smoser opened this issue Oct 25, 2023 · 2 comments
Open

Bug: stacker does not notice import file changed #530

smoser opened this issue Oct 25, 2023 · 2 comments
Labels
Milestone

Comments

@smoser
Copy link
Contributor

smoser commented Oct 25, 2023

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

@smoser smoser added the bug label Oct 25, 2023
@rchincha
Copy link
Contributor

rchincha commented Oct 25, 2023

HTTP HEAD request returns

< Content-Length: 34329287
< Last-Modified: Wed, 25 Oct 2023 02:50:40 GMT

and if available
< Digest: sha-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=

@smoser
Copy link
Contributor Author

smoser commented Oct 26, 2023

HTTP HEAD request returns

< Content-Length: 34329287 < Last-Modified: Wed, 25 Oct 2023 02:50:40 GMT

and if available < Digest: sha-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=

To be clear, this is a local file.
I suspect it is also a problem with remote imports, but local should definitely have all the information needed.

wrt remote requests ETag might also be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants