Skip to content

Commit a9522e3

Browse files
committed
Merge branch 'dev': support SSH into docker
2 parents 29ab45e + 7cc68ae commit a9522e3

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
@@ -47,6 +47,7 @@ env:
4747
DK_CONTEXT: .
4848
DK_NO_REMOTE_CACHE: 1
4949
DK_NO_BUILDTIME_PUSH: 1
50+
DK_CONVERT_MULTISTAGE_TO_IMAGE: 1
5051
DOCKERFILE_BASE: Dockerfile
5152
DOCKERFILE_INC: Dockerfile-inc
5253
DOCKERFILE_PACKAGE: Dockerfile-package
@@ -164,7 +165,7 @@ jobs:
164165
[ "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
165166
echo "::set-env name=OPT_PUSH_WHEN_FAIL::${OPT_PUSH_WHEN_FAIL}"
166167
167-
scripts/cleanup.sh
168+
[ "x${TEST}" = "x1" ] || scripts/cleanup.sh
168169
169170
- name: Set up Docker Buildx
170171
id: buildx
@@ -227,10 +228,11 @@ jobs:
227228
build_image clone
228229
229230
# Allow intermediate customization
230-
- name: Debug set, wait for SSH connection
231+
- name: Debug set, wait for SSH connection (timeout 5min)
231232
if: env.OPT_DEBUG == '1'
232233
env:
233234
TIMEOUT_MIN: 5
235+
TMATE_DOCKER_IMAGE: ${{env.DK_LAST_BUILD_TARGET}}
234236
uses: tete1030/debugger-action@my
235237

236238
- name: Apply customizations
@@ -302,10 +304,12 @@ jobs:
302304
path: ${{ env.FIRMWARE }}
303305

304306
# failure checking
305-
- name: Failed/debug set, wait for SSH connection ( you are safe to cancel the job now )
307+
- name: Failed/debug set, wait for SSH connection (timeout 30min. You are safe to cancel the job now.)
306308
if: |
307309
failure()
308310
|| env.OPT_DEBUG == '1'
311+
env:
312+
TMATE_DOCKER_IMAGE: ${{env.DK_LAST_BUILD_TARGET}}
309313
uses: tete1030/debugger-action@my
310314

311315
build-package:
@@ -396,7 +400,7 @@ jobs:
396400
[ "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
397401
echo "::set-env name=OPT_PUSH_WHEN_FAIL::${OPT_PUSH_WHEN_FAIL}"
398402
399-
scripts/cleanup.sh
403+
[ "x${TEST}" = "x1" ] || scripts/cleanup.sh
400404
401405
- name: Set up Docker Buildx
402406
id: buildx
@@ -448,10 +452,11 @@ jobs:
448452
pull_image
449453
450454
# Allow intermediate customization
451-
- name: Debug set, wait for SSH connection
455+
- name: Debug set, wait for SSH connection (timeout 5min)
452456
if: env.OPT_DEBUG == '1'
453457
env:
454458
TIMEOUT_MIN: 5
459+
TMATE_DOCKER_IMAGE: ${{env.DK_LAST_BUILD_TARGET}}
455460
uses: tete1030/debugger-action@my
456461

457462
- name: Update repo and packages
@@ -530,8 +535,10 @@ jobs:
530535
path: openwrt/bin
531536

532537
# failure checking
533-
- name: Failed/debug set, wait for SSH connection ( you are safe to cancel the job now )
538+
- name: Failed/debug set, wait for SSH connection (timeout 30min. You are safe to cancel the job now.)
534539
if: failure() || env.OPT_DEBUG == '1'
540+
env:
541+
TMATE_DOCKER_IMAGE: ${{env.DK_LAST_BUILD_TARGET}}
535542
uses: tete1030/debugger-action@my
536543

537544
build-direct:
@@ -576,7 +583,7 @@ jobs:
576583
run: scripts/customize.sh
577584

578585
# Allow intermediate customization
579-
- name: Debug set, wait for SSH connection
586+
- name: Debug set, wait for SSH connection (timeout 5min)
580587
if: env.OPT_DEBUG == '1'
581588
env:
582589
TIMEOUT_MIN: 5
@@ -628,6 +635,6 @@ jobs:
628635
path: ${{ env.FIRMWARE }}
629636

630637
# failure checking
631-
- name: Failed/debug set, wait for SSH connection ( you are safe to cancel the job now )
638+
- name: Failed/debug set, wait for SSH connection (timeout 30min. You are safe to cancel the job now.)
632639
if: failure() || env.OPT_DEBUG == '1'
633640
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)