Skip to content

Commit 37c7376

Browse files
authored
Merge pull request #1 from tete1030/master
123
2 parents a6f6a7d + a9522e3 commit 37c7376

File tree

8 files changed

+101
-48
lines changed

8 files changed

+101
-48
lines changed

.github/workflows/build-openwrt.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ env:
4848
DK_CONTEXT: .
4949
DK_NO_REMOTE_CACHE: 1
5050
DK_NO_BUILDTIME_PUSH: 1
51+
DK_CONVERT_MULTISTAGE_TO_IMAGE: 1
5152
DOCKERFILE_BASE: Dockerfile
5253
DOCKERFILE_INC: Dockerfile-inc
5354
DOCKERFILE_PACKAGE: Dockerfile-package
@@ -167,7 +168,7 @@ jobs:
167168
[ "x${{ (github.event_name == 'push' && contains(github.event.head_commit.message, '#push_when_fail#')) || github.event.client_payload.push_when_fail || github.event.deployment.payload.push_when_fail }}" != "xtrue" ] || OPT_PUSH_WHEN_FAIL=1
168169
echo "::set-env name=OPT_PUSH_WHEN_FAIL::${OPT_PUSH_WHEN_FAIL}"
169170
170-
scripts/cleanup.sh
171+
[ "x${TEST}" = "x1" ] || scripts/cleanup.sh
171172
172173
- name: Set up Docker Buildx
173174
id: buildx
@@ -230,10 +231,11 @@ jobs:
230231
build_image clone
231232
232233
# Allow intermediate customization
233-
- name: Debug set, wait for SSH connection
234+
- name: Debug set, wait for SSH connection (timeout 5min)
234235
if: env.OPT_DEBUG == '1'
235236
env:
236237
TIMEOUT_MIN: 5
238+
TMATE_DOCKER_IMAGE: ${{env.DK_LAST_BUILD_TARGET}}
237239
uses: tete1030/debugger-action@my
238240

239241
- name: Apply customizations
@@ -314,10 +316,12 @@ jobs:
314316
path: ${{ env.FIRMWARE }}
315317

316318
# failure checking
317-
- name: Failed/debug set, wait for SSH connection ( you are safe to cancel the job now )
319+
- name: Failed/debug set, wait for SSH connection (timeout 30min. You are safe to cancel the job now.)
318320
if: |
319321
failure()
320322
|| env.OPT_DEBUG == '1'
323+
env:
324+
TMATE_DOCKER_IMAGE: ${{env.DK_LAST_BUILD_TARGET}}
321325
uses: tete1030/debugger-action@my
322326

323327
build-package:
@@ -408,7 +412,7 @@ jobs:
408412
[ "x${{ (github.event_name == 'push' && contains(github.event.head_commit.message, '#push_when_fail#')) || github.event.client_payload.push_when_fail || github.event.deployment.payload.push_when_fail }}" != "xtrue" ] || OPT_PUSH_WHEN_FAIL=1
409413
echo "::set-env name=OPT_PUSH_WHEN_FAIL::${OPT_PUSH_WHEN_FAIL}"
410414
411-
scripts/cleanup.sh
415+
[ "x${TEST}" = "x1" ] || scripts/cleanup.sh
412416
413417
- name: Set up Docker Buildx
414418
id: buildx
@@ -460,10 +464,11 @@ jobs:
460464
pull_image
461465
462466
# Allow intermediate customization
463-
- name: Debug set, wait for SSH connection
467+
- name: Debug set, wait for SSH connection (timeout 5min)
464468
if: env.OPT_DEBUG == '1'
465469
env:
466470
TIMEOUT_MIN: 5
471+
TMATE_DOCKER_IMAGE: ${{env.DK_LAST_BUILD_TARGET}}
467472
uses: tete1030/debugger-action@my
468473

469474
- name: Update repo and packages
@@ -542,8 +547,10 @@ jobs:
542547
path: openwrt/bin
543548

544549
# failure checking
545-
- name: Failed/debug set, wait for SSH connection ( you are safe to cancel the job now )
550+
- name: Failed/debug set, wait for SSH connection (timeout 30min. You are safe to cancel the job now.)
546551
if: failure() || env.OPT_DEBUG == '1'
552+
env:
553+
TMATE_DOCKER_IMAGE: ${{env.DK_LAST_BUILD_TARGET}}
547554
uses: tete1030/debugger-action@my
548555

549556
build-direct:
@@ -588,7 +595,7 @@ jobs:
588595
run: scripts/customize.sh
589596

590597
# Allow intermediate customization
591-
- name: Debug set, wait for SSH connection
598+
- name: Debug set, wait for SSH connection (timeout 5min)
592599
if: env.OPT_DEBUG == '1'
593600
env:
594601
TIMEOUT_MIN: 5
@@ -649,6 +656,6 @@ jobs:
649656
path: ${{ env.FIRMWARE }}
650657

651658
# failure checking
652-
- name: Failed/debug set, wait for SSH connection ( you are safe to cancel the job now )
659+
- name: Failed/debug set, wait for SSH connection (timeout 30min. You are safe to cancel the job now.)
653660
if: failure() || env.OPT_DEBUG == '1'
654661
uses: tete1030/debugger-action@my

Dockerfiles/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# in the 'tests' dir is also changed in the same way.
1111
# 不推荐修改,已处在最优状态。如果仍要修改,确保tests文件夹中的对应文件以类似方式修改。
1212

13-
FROM ubuntu:18.04 AS init-env
13+
FROM ubuntu:18.04 AS init-env-stage
1414
RUN useradd -ms /bin/bash builder \
1515
&& apt-get -qq update && apt-get -qq install sudo \
1616
&& /bin/bash -c 'echo "builder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/99_sudo_include_file'
@@ -21,26 +21,26 @@ RUN mkdir scripts
2121
COPY --chown=builder:builder scripts/initenv.sh ./scripts/initenv.sh
2222
RUN scripts/initenv.sh
2323

24-
FROM init-env AS clone
24+
FROM init-env-stage AS clone-stage
2525
ARG REPO_URL
2626
ARG REPO_BRANCH
2727
COPY --chown=builder:builder scripts/update_repo.sh ./scripts/update_repo.sh
2828
RUN REPO_URL="${REPO_URL}" REPO_BRANCH="${REPO_BRANCH}" scripts/update_repo.sh
2929
COPY --chown=builder:builder scripts/update_feeds.sh ./scripts/update_feeds.sh
3030
RUN OPT_UPDATE_FEEDS=1 scripts/update_feeds.sh
3131

32-
FROM clone AS custom
32+
FROM clone-stage AS custom-stage
3333
ARG CONFIG_FILE
3434
COPY --chown=builder:builder scripts/customize.sh ./scripts/customize.sh
3535
COPY --chown=builder:builder patches ./patches
3636
COPY --chown=builder:builder ${CONFIG_FILE} ./
3737
RUN CONFIG_FILE="${CONFIG_FILE}" scripts/customize.sh
3838

39-
FROM custom AS download
39+
FROM custom-stage AS download-stage
4040
COPY --chown=builder:builder scripts/download.sh ./scripts/download.sh
4141
RUN scripts/download.sh
4242

43-
FROM download AS compile
43+
FROM download-stage AS compile-stage
4444
COPY --chown=builder:builder scripts/compile.sh ./scripts/compile.sh
4545
RUN COMPILE_OPTIONS="prepare" scripts/compile.sh m \
4646
|| COMPILE_OPTIONS="prepare" scripts/compile.sh s

Dockerfiles/Dockerfile-inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,24 @@
1111
# 不推荐修改,已处在最优状态。如果仍要修改,确保tests文件夹中的对应文件以类似方式修改。
1212

1313
ARG DK_IMAGE_BASE
14-
FROM ${DK_IMAGE_BASE} AS clone
14+
FROM ${DK_IMAGE_BASE} AS clone-stage
1515
ARG OPT_UPDATE_REPO
1616
ARG OPT_UPDATE_FEEDS
1717
# No cache to use for incremental building, so we just copy all files altogether
1818
COPY --chown=builder:builder scripts ./scripts
1919
RUN [ "x${OPT_UPDATE_REPO}" != "x1" ] || scripts/update_repo.sh
2020
RUN OPT_UPDATE_FEEDS="${OPT_UPDATE_FEEDS}" scripts/update_feeds.sh
2121

22-
FROM clone AS custom
22+
FROM clone-stage AS custom-stage
2323
COPY --chown=builder:builder patches ./patches
2424
ARG CONFIG_FILE
2525
COPY --chown=builder:builder ${CONFIG_FILE} ./
2626
RUN CONFIG_FILE="${CONFIG_FILE}" NONSTRICT_PATCH=1 scripts/customize.sh
2727

28-
FROM custom AS download
28+
FROM custom-stage AS download-stage
2929
RUN scripts/download.sh
3030

31-
FROM download AS compile
31+
FROM download-stage AS compile-stage
3232
COPY --chown=builder:builder scripts/compile.sh ./scripts/compile.sh
3333
RUN COMPILE_OPTIONS="prepare" scripts/compile.sh m \
3434
|| COMPILE_OPTIONS="prepare" scripts/compile.sh s

Dockerfiles/Dockerfile-package

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@
1111
# 不推荐修改,已处在最优状态。如果仍要修改,确保tests文件夹中的对应文件以类似方式修改。
1212

1313
ARG DK_IMAGE_BASE
14-
FROM ${DK_IMAGE_BASE} AS clone
14+
FROM ${DK_IMAGE_BASE} AS clone-stage
1515
ARG OPT_UPDATE_FEEDS
1616
# No cache to use for incremental building, so we just copy all files altogether
1717
COPY --chown=builder:builder scripts ./scripts
1818
RUN OPT_UPDATE_FEEDS="${OPT_UPDATE_FEEDS}" scripts/update_feeds.sh
1919

20-
FROM clone AS custom
20+
FROM clone-stage AS custom-stage
2121
COPY --chown=builder:builder patches ./patches
2222
ARG CONFIG_FILE
2323
COPY --chown=builder:builder ${CONFIG_FILE} ./
2424
RUN CONFIG_FILE="${CONFIG_FILE}" NONSTRICT_PATCH=1 scripts/customize.sh
2525

26-
FROM custom AS download
26+
FROM custom-stage AS download-stage
2727
RUN scripts/download.sh
2828

29-
FROM download AS compile
29+
FROM download-stage AS compile-stage
3030
RUN (COMPILE_OPTIONS="package/compile" scripts/compile.sh m \
3131
|| COMPILE_OPTIONS="package/compile" scripts/compile.sh s) \
3232
&& (COMPILE_OPTIONS="package/index" scripts/compile.sh m \

Dockerfiles/tests/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Author: Texot
66
#=================================================
77

8-
FROM ubuntu:18.04 AS init-env
8+
FROM ubuntu:18.04 AS init-env-stage
99
RUN useradd -ms /bin/bash builder \
1010
&& apt-get -qq update && apt-get -qq install sudo \
1111
&& /bin/bash -c 'echo "builder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/99_sudo_include_file'
@@ -15,7 +15,7 @@ RUN mkdir scripts
1515
COPY --chown=builder:builder scripts/initenv.sh ./scripts/initenv.sh
1616
# RUN scripts/initenv.sh
1717

18-
FROM init-env AS clone
18+
FROM init-env-stage AS clone-stage
1919
ARG REPO_URL
2020
ARG REPO_BRANCH
2121
COPY --chown=builder:builder scripts/update_repo.sh ./scripts/update_repo.sh
@@ -24,18 +24,18 @@ COPY --chown=builder:builder scripts/update_feeds.sh ./scripts/update_feeds.sh
2424
# RUN OPT_UPDATE_FEEDS=1 scripts/update_feeds.sh
2525
RUN mkdir openwrt
2626

27-
FROM clone AS custom
27+
FROM clone-stage AS custom-stage
2828
ARG CONFIG_FILE
2929
COPY --chown=builder:builder scripts/customize.sh ./scripts/customize.sh
3030
COPY --chown=builder:builder patches ./patches
3131
COPY --chown=builder:builder ${CONFIG_FILE} ./
3232
# RUN CONFIG_FILE="${CONFIG_FILE}" scripts/customize.sh
3333

34-
FROM custom AS download
34+
FROM custom-stage AS download-stage
3535
COPY --chown=builder:builder scripts/download.sh ./scripts/download.sh
3636
# RUN scripts/download.sh
3737

38-
FROM download AS compile
38+
FROM download-stage AS compile-stage
3939
COPY --chown=builder:builder scripts/compile.sh ./scripts/compile.sh
4040
# RUN COMPILE_OPTIONS="prepare" scripts/compile.sh m \
4141
# || COMPILE_OPTIONS="prepare" scripts/compile.sh s

Dockerfiles/tests/Dockerfile-inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
#=================================================
77

88
ARG DK_IMAGE_BASE
9-
FROM ${DK_IMAGE_BASE} AS clone
9+
FROM ${DK_IMAGE_BASE} AS clone-stage
1010
ARG OPT_UPDATE_REPO
1111
ARG OPT_UPDATE_FEEDS
1212
COPY --chown=builder:builder scripts ./scripts
1313
# RUN [ "x${OPT_UPDATE_REPO}" != "x1" ] || scripts/update_repo.sh
1414
# RUN OPT_UPDATE_FEEDS="${OPT_UPDATE_FEEDS}" scripts/update_feeds.sh
1515

16-
FROM clone AS custom
16+
FROM clone-stage AS custom-stage
1717
COPY --chown=builder:builder patches ./patches
1818
ARG CONFIG_FILE
1919
COPY --chown=builder:builder ${CONFIG_FILE} ./
2020
# RUN CONFIG_FILE="${CONFIG_FILE}" NONSTRICT_PATCH=1 scripts/customize.sh
2121

22-
FROM custom AS download
22+
FROM custom-stage AS download-stage
2323
# RUN scripts/download.sh
2424

25-
FROM download AS compile
25+
FROM download-stage AS compile-stage
2626
COPY --chown=builder:builder scripts/compile.sh ./scripts/compile.sh
2727
# RUN COMPILE_OPTIONS="prepare" scripts/compile.sh m \
2828
# || COMPILE_OPTIONS="prepare" scripts/compile.sh s

Dockerfiles/tests/Dockerfile-package

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
#=================================================
77

88
ARG DK_IMAGE_BASE
9-
FROM ${DK_IMAGE_BASE} AS clone
9+
FROM ${DK_IMAGE_BASE} AS clone-stage
1010
ARG OPT_UPDATE_FEEDS
1111
COPY --chown=builder:builder scripts ./scripts
1212
# RUN OPT_UPDATE_FEEDS="${OPT_UPDATE_FEEDS}" scripts/update_feeds.sh
1313

14-
FROM clone AS custom
14+
FROM clone-stage AS custom-stage
1515
COPY --chown=builder:builder patches ./patches
1616
ARG CONFIG_FILE
1717
COPY --chown=builder:builder ${CONFIG_FILE} ./
1818
# RUN CONFIG_FILE="${CONFIG_FILE}" NONSTRICT_PATCH=1 scripts/customize.sh
1919

20-
FROM custom AS download
20+
FROM custom-stage AS download-stage
2121
# RUN scripts/download.sh
2222

23-
FROM download AS compile
23+
FROM download-stage AS compile-stage
2424
# RUN (COMPILE_OPTIONS="package/compile" scripts/compile.sh m \
2525
# || COMPILE_OPTIONS="package/compile" scripts/compile.sh s) \
2626
# && (COMPILE_OPTIONS="package/index" scripts/compile.sh m \

0 commit comments

Comments
 (0)