Skip to content

Commit

Permalink
fix: Fix web builder (#8747)
Browse files Browse the repository at this point in the history
* fix web builder

* update workflows

* pass var to container
  • Loading branch information
maciaszczykm authored Mar 6, 2024
1 parent 116f74e commit 3406310
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 21 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions hack/docker/docker.compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
27 changes: 27 additions & 0 deletions hack/include/build.mk
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 3 additions & 1 deletion modules/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down

0 comments on commit 3406310

Please sign in to comment.