- 
                Notifications
    You must be signed in to change notification settings 
- Fork 596
bake: handle tilde expansion in filepaths #3409
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
base: master
Are you sure you want to change the base?
Conversation
2ffd2a7    to
    cb73b63      
    Compare
  
    Signed-off-by: David Karlsson <[email protected]>
cb73b63    to
    d5c08e6      
    Compare
  
    | cc @crazy-max ptal 🙂 | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks!
Was wondering if fs entitlements would still be applied and looks like it as expansion happens when reading targets:
target "default" {
  output = ["~/bake"]
}docker buildx bake --print
{
  "group": {
    "default": {
      "targets": [
        "default"
      ]
    }
  },
  "target": {
    "default": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "output": [
        {
          "dest": "/home/crazy/bake",
          "type": "local"
        }
      ]
    }
  }
}
docker buildx bake
#0 building with "default" instance using docker driver
#1 [internal] load local bake definitions
#1 reading docker-bake.hcl 43B / 43B done
#1 DONE 0.0s
Your build is requesting privileges for following possibly insecure capabilities:
 - Write access to path /home/crazy
In order to not see this message in the future pass "--allow=fs.write=/home/crazy" to grant requested privileges.
Your full command with requested privileges:
docker buildx bake --allow=fs.write=/home/crazy
To disable filesystem entitlements checks, you can set BUILDX_BAKE_ENTITLEMENTS_FS=0 .
Do you want to grant requested privileges and continue? [y/N]
| Slightly concerned if this will start users expecting  | 
| @thaJeztah that's a valid concern. For things like  I quite like the  | 
| I agree with @thaJeztah that adding support for a  Recently, @crazy-max added a  Then  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Putting a request changes until we have a further discussion on if we want to merge this feature or not.
Description
Adds tilde expansion for filepath attributes in bake files.
~/path- expands to current user's home directory + path~- expands to current user's home directory~username/path- expands to specified user's home directory + pathNote on Windows support:
~is equivalent to%USERPROFILE%~usernameis not supportedRelated issues