Skip to content

Commit

Permalink
Merge pull request #4048 from crazy-max/hack-updates
Browse files Browse the repository at this point in the history
hack: enhancements and deadcode removal
  • Loading branch information
crazy-max authored Sep 19, 2023
2 parents 7589637 + a536dea commit bbe48e7
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 258 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ env:
GO_VERSION: "1.20"
SETUP_BUILDX_VERSION: "latest"
SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest"
TESTFLAGS: "-v --parallel=6 --timeout=30m"
GOTESTSUM_FORMAT: "standard-verbose"

jobs:
prepare:
Expand Down Expand Up @@ -102,6 +100,11 @@ jobs:
runs-on: ubuntu-22.04
needs:
- prepare
env:
TESTFLAGS: "-v --parallel=6 --timeout=30m"
GOTESTSUM_FORMAT: "standard-verbose"
TEST_IMAGE_BUILD: "0"
TEST_IMAGE_ID: "buildkit-tests"
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -140,6 +143,14 @@ jobs:
version: ${{ env.SETUP_BUILDX_VERSION }}
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
buildkitd-flags: --debug
-
name: Build test image
uses: docker/bake-action@v4
with:
targets: integration-tests
set: |
*.cache-from=type=gha,scope=${{ inputs.cache_scope }}
*.output=type=docker,name=${{ env.TEST_IMAGE_ID }}
-
name: Test
continue-on-error: ${{ matrix.tags == 'nydus' }}
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
prefix=/usr/local
bindir=$(prefix)/bin

ifneq (, $(BUILDX_BIN))
export BUILDX_CMD = $(BUILDX_BIN)
else ifneq (, $(shell docker buildx version))
export BUILDX_CMD = docker buildx
else ifneq (, $(shell command -v buildx))
export BUILDX_CMD = $(command -v buildx)
endif

export BUILDX_CMD ?= docker buildx

.PHONY: binaries
Expand Down
39 changes: 36 additions & 3 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ variable "BUILDKITD_TAGS" {
default = null
}

variable "HTTP_PROXY" {
default = null
}

variable "HTTPS_PROXY" {
default = null
}

variable "NO_PROXY" {
default = null
}

variable "GOBUILDFLAGS" {
default = null
}

variable "VERIFYFLAGS" {
default = null
}

variable "CGO_ENABLED" {
default = null
}

# Defines the output folder
variable "DESTDIR" {
default = ""
Expand All @@ -28,6 +52,13 @@ target "_common" {
ALPINE_VERSION = ALPINE_VERSION
GO_VERSION = GO_VERSION
NODE_VERSION = NODE_VERSION
BUILDKITD_TAGS = BUILDKITD_TAGS
HTTP_PROXY = HTTP_PROXY
HTTPS_PROXY = HTTPS_PROXY
NO_PROXY = NO_PROXY
GOBUILDFLAGS = GOBUILDFLAGS
VERIFYFLAGS = VERIFYFLAGS
CGO_ENABLED = CGO_ENABLED
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
}
}
Expand All @@ -39,9 +70,6 @@ group "default" {
target "binaries" {
inherits = ["_common"]
target = "binaries"
args = {
BUILDKITD_TAGS = BUILDKITD_TAGS
}
output = [bindir("build")]
}

Expand Down Expand Up @@ -74,6 +102,11 @@ target "integration-tests-base" {
output = ["type=cacheonly"]
}

target "integration-tests" {
inherits = ["integration-tests-base"]
target = "integration-tests"
}

group "validate" {
targets = ["lint", "validate-vendor", "validate-doctoc", "validate-generated-files", "validate-shfmt", "validate-docs"]
}
Expand Down
14 changes: 0 additions & 14 deletions frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,4 @@ LABEL moby.buildkit.frontend.caps="moby.buildkit.frontend.inputs,moby.buildkit.f
COPY --from=build /dockerfile-frontend /bin/dockerfile-frontend
ENTRYPOINT ["/bin/dockerfile-frontend"]


FROM base AS buildid-check
RUN apt-get update && apt-get --no-install-recommends install -y jq
COPY /frontend/dockerfile/cmd/dockerfile-frontend/hack/check-daily-outdated .
COPY --from=r.j3ss.co/reg /usr/bin/reg /bin
COPY --from=build /dockerfile-frontend .
ARG CHANNEL
ARG REPO
ARG DATE
RUN ./check-daily-outdated $CHANNEL $REPO $DATE /out

FROM scratch AS buildid
COPY --from=buildid-check /out/ /

FROM release

This file was deleted.

49 changes: 1 addition & 48 deletions frontend/dockerfile/cmd/dockerfile-frontend/hack/release
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ set -eu

: "${RELEASE=false}"
: "${PLATFORMS=}"
: "${DAILY_TARGETS=}"

usage() {
echo "$0 (master|tag|daily) (tag|channel) <repo> [push]"
echo "$0 (master|tag) (tag|channel) <repo> [push]"
exit 1
}

Expand Down Expand Up @@ -114,50 +113,4 @@ case $TYP in
--file "./frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile" \
$currentcontext
;;
"daily")
# if [ -z $DAILY_TARGETS ]; then
# DAILY_TARGETS=""
# fi

for TAG in $DAILY_TARGETS; do

tagf=./frontend/dockerfile/release/$TAG/tags
if [ ! -f $tagf ]; then
echo "invalid release $TAG"
exit 1
fi
buildTags=$(cat $tagf)

# find the buildID of the last pushed image
# returns a BuildID if rebuild needed

tmp=$(mktemp -d -t buildid.XXXXXXXXXX)
dt=$(date +%Y%m%d)
buildxCmd build $platformFlag $cacheFromFlags $cacheToFlags $nocacheFilterFlag \
--target "buildid" \
--build-arg "CHANNEL=$TAG" \
--build-arg "BUILDTAGS=$buildTags" \
--build-arg "REPO=$REPO" \
--build-arg "DATE=$dt" \
--output "type=local,dest=$tmp" \
--file "./frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile" \
$currentcontext

if [ -f $tmp/buildid ]; then
buildid=$(cat $tmp/buildid)
echo "buildid: $buildid"

buildxCmd build $platformFlag $cacheFromFlags $cacheToFlags $nocacheFilterFlag $(buildAttestFlags) \
--build-arg "CHANNEL=$TAG" \
--build-arg "BUILDTAGS=$buildTags" \
--output "type=image,name=$REPO:$dt-$TAG,$pushFlag" \
--file "./frontend/dockerfile/cmd/dockerfile-frontend/Dockerfile" \
$currentcontext
rm $tmp/buildid
fi
rm -r $tmp

done

;;
esac
19 changes: 0 additions & 19 deletions hack/bootstrap-buildx

This file was deleted.

6 changes: 3 additions & 3 deletions hack/images
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ PUSH=$3
. $(dirname $0)/util
set -eu -o pipefail

: ${RELEASE=false}
: ${PLATFORMS=}
: ${TARGET=}
: "${RELEASE=false}"
: "${PLATFORMS=}"
: "${TARGET=}"

versionTag=$(git describe --always --tags --match "v[0-9]*")

Expand Down
50 changes: 0 additions & 50 deletions hack/install-buildx

This file was deleted.

Loading

0 comments on commit bbe48e7

Please sign in to comment.