-
Notifications
You must be signed in to change notification settings - Fork 615
Open
Labels
Description
Contributing guidelines
- I've read the contributing guidelines and wholeheartedly agree
I've found a bug and checked that ...
- ... the documentation does not mention anything about my problem
- ... there are no open or closed issues that are related to my problem
Description
The Bake regex_replace function does not appear to support the beginning of text anchor.
Ex.:
test_1 = regex_replace("latest-something", "latest", "3") # => "3-something" <-- works (no anchor)
test_1 = regex_replace("latest-something", "^latest", "3") # => "latest-something" <-- does not work
The Bake implementation is mapped to stdlib.RegexReplaceFunc, which looks right; see go-cty//cty/function/stdlib/string_replace.go#L47
Expected behaviour
The regex_replace() function should accept a substring pattern with an anchor and correctly match and replace it in the search string.
Actual behaviour
The regex_replace() function does not correctly match and replace substring patterns with anchors.
Buildx version
github.com/docker/buildx v0.30.1 9e66234
Docker info
Client: Docker Engine - Community
Version: 29.1.4
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.30.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v5.0.1
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 25
Running: 7
Paused: 0
Stopped: 18
Images: 91
Server Version: 29.1.4
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: dea7da592f5d1d2b7755e3a161be07f43fad8f75
runc version: v1.3.4-0-gd6d73eb8
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.8.0-1045-gcp
Operating System: Ubuntu 22.04.5 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 31.34GiB
Name: dee-ise-ops03-devops-remote-1
ID: cfb8ee4b-ab38-4dcc-8635-5b91a4720b5b
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: jonbackhaus
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Registry Mirrors:
https://repo.mantech.com:8081/
Live Restore Enabled: false
Firewall Backend: iptables+firewalld
Builders list
builder docker-container
\_ builder0 \_ unix:///var/run/docker.sock inactive
docker-container docker-container
\_ docker-container0 \_ unix:///var/run/docker.sock inactive
default* docker
\_ default \_ default running v0.26.3 linux/amd64 (+4), linux/386
Configuration
variable "IMAGE_TAG" {
default = "latest"
}
target "default" {
context = "." # local working directory
dockerfile = "Containerfile"
tags = [
"localhost/test:${IMAGE_TAG}"
]
}
target "test" {
inherits = ["default"]
tags = [for tag in target.default.tags : regex_replace(tag, "^latest", "3")]
}Build logs
Additional info
No response
Reactions are currently unavailable