Skip to content

Commit

Permalink
[cirque] Download chip-cirque-device-base from docker hub when avai…
Browse files Browse the repository at this point in the history
…lable (#4940)

* [cirque] Only build docker image when the image does not exists on dockerhub

* Update test warpper

* Add GITHUB_ACTION_RUN=1 for cirque bootstrap

* Update help text
  • Loading branch information
erjiaqing authored and pull[bot] committed Mar 1, 2021
1 parent a6d6607 commit 6738530
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/cirque.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ jobs:
submodules: true
- name: Bootstrap
run: |
integrations/docker/images/chip-build-cirque/run.sh scripts/tests/cirque_tests.sh bootstrap
integrations/docker/images/chip-build-cirque/run.sh \
--env GITHUB_ACTION_RUN=1 \
-- scripts/tests/cirque_tests.sh bootstrap
- name: Artifact suffix
id: outsuffix
uses: haya14busa/action-cond@v1.0.0
Expand Down
21 changes: 17 additions & 4 deletions integrations/docker/images/chip-cirque-device-base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ VERSION=${DOCKER_BUILD_VERSION:-$(cat version)}
Build and (optionally tag as latest, push) a docker image from Dockerfile in CWD
Options:
--no-cache passed as a docker build argument
--latest update latest to the current built version (\"$VERSION\")
--push push image(s) to docker.io (requires docker login for \"$ORG\")
--help get this message
--try-download try to download latest image from dockerhub and skip whole
build procedure if the expected image version is downloaded.
--no-cache passed as a docker build argument
--latest update latest to the current built (or downloaded) version (\"$VERSION\")
--push push image(s) to docker.io (requires docker login for \"$ORG\")
--help get this message
"
exit 0
Expand All @@ -58,6 +60,17 @@ set -ex

[[ -n $VERSION ]] || die "version cannot be empty"

if [[ ${*/--try-download//} != "${*}" ]]; then
docker pull "$ORG"/"$IMAGE":"$VERSION"
if [[ $? -eq 0 ]]; then
# tag it as latest for this version, note: this should only be used on CI
[[ ${*/--latest//} != "${*}" ]] && {
docker tag "$ORG"/"$IMAGE":"$VERSION" "$ORG"/"$IMAGE":latest
}
exit 0
fi
fi

# go find and build any CHIP images this image is "FROM"
awk -F/ '/^FROM connectedhomeip/ {print $2}' Dockerfile | while read -r dep; do
dep=${dep%:*}
Expand Down
8 changes: 7 additions & 1 deletion scripts/tests/cirque_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ function cirquetest_bootstrap() {
cd "$REPO_DIR"/third_party/cirque/repo
pip3 install pycodestyle==2.5.0 wheel
make NO_GRPC=1 install -j
"$REPO_DIR"/integrations/docker/images/chip-cirque-device-base/build.sh

if [[ "x$GITHUB_ACTION_RUN" = "x1" ]]; then
"$REPO_DIR"/integrations/docker/images/chip-cirque-device-base/build.sh --try-download --latest
else
"$REPO_DIR"/integrations/docker/images/chip-cirque-device-base/build.sh --try-download
fi

__cirquetest_build_ot
pip3 install -r requirements_nogrpc.txt

Expand Down

0 comments on commit 6738530

Please sign in to comment.