From c2893482aa35388078b72f229023cabf4d8878dd Mon Sep 17 00:00:00 2001 From: anmol372 Date: Mon, 16 Dec 2024 13:57:47 -0800 Subject: [PATCH] update opflex build to only build opflex-build-base image if a tag comtaining "opflex-build-base" is pushed --- .travis.yml | 2 +- docker/travis/build-opflex-travis.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index d6c9d57b8..e214ea5ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ jobs: - export UPSTREAM_ID=81c2369 script: - echo "Skip running UTs" - - git clone http://www.github.com/noironetworks/cicd -b main /tmp/cicd + - git clone http://www.github.com/noironetworks/cicd -b opflextag /tmp/cicd - /tmp/cicd/travis/check-git-tag.sh; RETURN_CODE=$? ; if [ $RETURN_CODE -eq 140 ]; then travis_terminate 0; elif [ $RETURN_CODE -ne 0 ]; then travis_terminate $RETURN_CODE; fi - /tmp/cicd/travis/build-push-opflex-images.sh || travis_terminate 1 diff --git a/docker/travis/build-opflex-travis.sh b/docker/travis/build-opflex-travis.sh index 06cafc55e..e45b2c164 100755 --- a/docker/travis/build-opflex-travis.sh +++ b/docker/travis/build-opflex-travis.sh @@ -21,10 +21,15 @@ DOCKER_DIR=docker/travis OPFLEX_DIR=. export OPFLEX_DIR -BUILD_BASE=$(git show -s --format=%B "${TRAVIS_TAG}" | grep -i "opflex-build-base" | tr -d '\n') +# Check if the tag contains "opflex-build-base" +if [[ "${TRAVIS_TAG}" == *"opflex-build-base"* ]]; then + BUILD_BASE=true +else + BUILD_BASE=false +fi set -Eeuxo pipefail -if [[ -n "$BUILD_BASE" ]]; then +if [[ "${BUILD_BASE}" == true ]]; then echo "starting opflex-base build" docker build $BUILDARG $SECOPT -t $DOCKER_HUB_ID/opflex-build-base:$DOCKER_TAG -f $DOCKER_DIR/Dockerfile-opflex-build-base . &> /tmp/opflex-build-base.log & while [ ! -f /tmp/opflex-build-base.log ]; do sleep 10; done