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] State under subpath from base image is not persisted when using image source #379

Open
1 task done
adamperlin opened this issue Sep 23, 2024 · 0 comments
Open
1 task done
Assignees
Labels
bug Something isn't working
Milestone

Comments

@adamperlin
Copy link
Contributor

adamperlin commented Sep 23, 2024

Expected Behavior

When a user makes use of an image source, they should be able to run commands in the context of that base image, including being able to rely on the presence of files under arbitrary subpaths

Actual Behavior

If a user specifies a non-root subpath to extract from the base image then we mount a scratch fs over said path without accounting for what might have been at that path, meaning that commands meant to execute in the context of the base image may fail and files from the base image under a particular subpath that were meant to be persisted when the subpath contents are extracted will not be copied as part of the source.

Steps To Reproduce

Consider the following spec:

# syntax=ghcr.io/azure/dalec/frontend:latest
name: test-dalec-package
packager: Microsoft
version: 0.1
revision: 1
description: "A test package"
license: "Apache 2.0"

sources:
  img:
    path: "/etc"
    image:
      ref: "busybox:latest"
      cmd:
        steps:
          - command: "ls -lrt /etc"

build:
  steps:
    - command: |
       [ ! -z $(ls -A img/) ]

The contents of /etc from busybox should be available under the img source directory, and the test command within the build steps should succeed. Instead, the build fails because there are no files in the img source directory. This is due to faulty current behavior in our source-from-image implementation in which we unconditionally mount a scratch fs over any non-root subpath a user has provided in the base image.

Are you willing to submit PRs to contribute to this bug fix?

  • Yes, I am willing to implement it.
@adamperlin adamperlin added the bug Something isn't working label Sep 23, 2024
@adamperlin adamperlin self-assigned this Sep 23, 2024
@cpuguy83 cpuguy83 added this to the v0.10.0 milestone Oct 9, 2024
@cpuguy83 cpuguy83 modified the milestones: v0.10.0, v0.11.0 Oct 26, 2024
@cpuguy83 cpuguy83 modified the milestones: v0.11.0, v0.12.0 Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants