mirror of
https://github.com/moby/buildkit.git
synced 2026-08-10 17:14:08 +00:00
Merge pull request #1848 from crazy-max/fix-rootless-tag
Fix rootless tag
This commit is contained in:
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -255,7 +255,7 @@ jobs:
|
||||
- name: Prepare
|
||||
id: prep
|
||||
run: |
|
||||
TAG=local
|
||||
TAG=pr
|
||||
PUSH=false
|
||||
if [ "${{ github.event_name }}" = "schedule" ]; then
|
||||
TAG=nightly
|
||||
|
||||
1
Makefile
1
Makefile
@@ -7,6 +7,7 @@ binaries: FORCE
|
||||
images: FORCE
|
||||
# moby/buildkit:local and moby/buildkit:local-rootless are created on Docker
|
||||
hack/images local moby/buildkit
|
||||
TARGET=rootless hack/images local moby/buildkit
|
||||
|
||||
install: FORCE
|
||||
mkdir -p $(DESTDIR)$(bindir)
|
||||
|
||||
34
hack/images
34
hack/images
@@ -25,6 +25,23 @@ if [ -z "$TAG" ] || [ -z "$REPO" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
localmode=""
|
||||
if [[ "$TAG" == "local" ]]; then
|
||||
localmode="1"
|
||||
if [ "$PUSH" = "push" ]; then
|
||||
echo >&2 "local images cannot be pushed"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
outputFlag="--output=type=image,push=false"
|
||||
if [ "$PUSH" = "push" ]; then
|
||||
outputFlag="--output=type=image,push=true"
|
||||
fi
|
||||
if [ -n "$localmode" ]; then
|
||||
outputFlag="--output=type=docker"
|
||||
fi
|
||||
|
||||
pushFlag="push=false"
|
||||
if [ "$PUSH" = "push" ]; then
|
||||
pushFlag="push=true"
|
||||
@@ -35,6 +52,11 @@ if [ -n "$TARGET" ]; then
|
||||
targetFlag="--target=$TARGET"
|
||||
fi
|
||||
|
||||
tagMain="$REPO:$TAG"
|
||||
if [ -n "$TARGET" ]; then
|
||||
tagMain="$tagMain-$TARGET"
|
||||
fi
|
||||
|
||||
tagLatest=""
|
||||
if [[ "$versionTag" == "$TAG" ]]; then
|
||||
if [ -n "$TARGET" ]; then
|
||||
@@ -44,20 +66,22 @@ if [[ "$versionTag" == "$TAG" ]]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
importCacheFlags="--cache-from=type=registry,ref=$REPO:$TAG$tagLatest "
|
||||
importCacheFlags="--cache-from=type=registry,ref=$tagMain$tagLatest "
|
||||
if [[ -n "$cacheref" ]] && [[ "$cachetype" = "local" ]]; then
|
||||
for ref in $cacheref; do
|
||||
importCacheFlags="$importCacheFlags--cache-from=type=local,src=$ref "
|
||||
done
|
||||
fi
|
||||
if [ -n "$localmode" ]; then
|
||||
importCacheFlags=""
|
||||
fi
|
||||
|
||||
exportCacheFlags=""
|
||||
if [ "$PUSH" = "push" ]; then
|
||||
exportCacheFlags="--cache-to=type=inline "
|
||||
fi
|
||||
|
||||
buildxCmd build $targetFlag $importCacheFlags $exportCacheFlags \
|
||||
buildxCmd build $targetFlag $importCacheFlags $exportCacheFlags $outputFlag \
|
||||
--platform "$PLATFORMS" \
|
||||
--tag "$REPO:$TAG$tagLatest" \
|
||||
--output "type=image,$pushFlag" \
|
||||
$currentref
|
||||
--tag "$tagMain$tagLatest" \
|
||||
$currentcontext
|
||||
|
||||
Reference in New Issue
Block a user