diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 589ef127bc73..59ac04d7eca4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,26 +33,6 @@ env: NODE_OPTIONS: "--max-old-space-size=8192" TERM: xterm jobs: - pull-request-labels-check: - name: Pull request labels check - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - steps: - - uses: mheap/github-action-required-labels@v5 - with: - mode: exactly - count: 1 - labels: "kind/bug, kind/cleanup, kind/documentation, kind/feature, kind/i18n, dependencies" - - pull-request-title-check: - name: Pull request title check - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - dependency-review: name: Dependency review if: github.event_name == 'pull_request' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 000000000000..98ed6eecf47e --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,39 @@ +# Copyright 2017 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: PR +on: + pull_request: + branches: [master] + types: [opened, labeled, unlabeled, synchronize] +permissions: + contents: read +jobs: + labels-check: + name: Labels check + runs-on: ubuntu-latest + steps: + - uses: mheap/github-action-required-labels@v5 + with: + mode: exactly + count: 1 + labels: "kind/bug, kind/cleanup, kind/documentation, kind/feature, kind/i18n, dependencies" + + title-check: + name: Title check + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 77e4ab23ddc7..5ff570370625 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ ROOT_DIRECTORY := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) +include $(ROOT_DIRECTORY)/hack/include/build.mk include $(ROOT_DIRECTORY)/hack/include/config.mk include $(ROOT_DIRECTORY)/hack/include/ensure.mk include $(ROOT_DIRECTORY)/hack/include/kind.mk @@ -107,6 +108,7 @@ ifndef NO_BUILD SYSTEM_BANNER_SEVERITY=$(SYSTEM_BANNER_SEVERITY) \ SIDECAR_HOST=$(SIDECAR_HOST) \ VERSION="v0.0.0-prod" \ + WEB_BUILDER_ARCH=$(ARCH) \ docker compose -f $(DOCKER_COMPOSE_PATH) --project-name=$(PROJECT_NAME) build \ --no-cache endif diff --git a/hack/docker/docker.compose.yaml b/hack/docker/docker.compose.yaml index db065e00458a..e2be00f7c4be 100644 --- a/hack/docker/docker.compose.yaml +++ b/hack/docker/docker.compose.yaml @@ -68,6 +68,7 @@ services: dockerfile: modules/web/Dockerfile args: VERSION: ${VERSION:?} + WEB_BUILDER_ARCH: ${WEB_BUILDER_ARCH:?} command: - "--kubeconfig=${KUBECONFIG:?}" - "--locale-config=/public/locale_conf.json" diff --git a/hack/include/build.mk b/hack/include/build.mk new file mode 100644 index 000000000000..89059872c5bc --- /dev/null +++ b/hack/include/build.mk @@ -0,0 +1,27 @@ +# BUILDARCH is the host machine architecture +BUILDARCH ?= $(shell uname -m) + +# BUILDOS is the host machine OS +BUILDOS ?= $(shell uname -s) + +ifeq ($(BUILDARCH),x86_64) + BUILDARCH=amd64 +endif +ifeq ($(BUILDARCH),arch64) + BUILDARCH=arm64 +endif +ifeq ($(BUILDARCH),armv7l) + BUILDARCH=armv7 +endif + +ifeq ($(BUILDOS),Linux) + BUILDOS=linux +endif +ifeq ($(BUILDOS),Darwin) + BUILDOS=darwin +endif + +# ARCH is the target build architecture. Unless overridden during build, host architecture (BUILDARCH) will be used +ARCH ?= $(BUILDARCH) +# OS is the target build OS. Unless overridden during build, host OS (BUILDOS) will be used +OS ?= $(BUILDOS) diff --git a/modules/web/Dockerfile b/modules/web/Dockerfile index ce5f915b86b8..2c64c47965e2 100644 --- a/modules/web/Dockerfile +++ b/modules/web/Dockerfile @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +ARG WEB_BUILDER_ARCH=amd64 + FROM alpine:3.19 as user ENV USER=nonroot @@ -27,7 +29,7 @@ RUN adduser \ --uid "${UID}" \ "${USER}" -FROM --platform=linux/amd64 node:20.11.1-alpine3.19 as web-builder +FROM --platform=linux/${WEB_BUILDER_ARCH} node:20.11.1-alpine3.19 as web-builder RUN apk add --no-cache \ make \