diff mbox series

[isar-cip-core,2/3] .gitlab-ci.yml: Added a new variable to control deployment

Message ID 20230906045643.2640096-3-Sai.Sathujoda@toshiba-tsip.com (mailing list archive)
State Superseded
Headers show
Series Enabling additional features in security image | expand

Commit Message

Sai.Sathujoda@toshiba-tsip.com Sept. 6, 2023, 4:56 a.m. UTC
From: Sai <Sai.Sathujoda@toshiba-tsip.com>

This "EXTRA_ARTIFACT" variable is enabled by default so that it can be
disabled for targets where the uploading of only disk image is
necessary.

As per the requirement, only disk image upload is sufficient for security
image. So the EXTRA_ARTIFACT is disabled for the targets involving
security extension.

Signed-off-by: Sai <Sai.Sathujoda@toshiba-tsip.com>
---
 .gitlab-ci.yml             |  6 +++++-
 scripts/deploy-cip-core.sh | 31 +++++++++++++++++--------------
 2 files changed, 22 insertions(+), 15 deletions(-)

Comments

Jan Kiszka Sept. 6, 2023, 9:30 a.m. UTC | #1
On 06.09.23 06:56, Sai.Sathujoda@toshiba-tsip.com wrote:
> From: Sai <Sai.Sathujoda@toshiba-tsip.com>
> 
> This "EXTRA_ARTIFACT" variable is enabled by default so that it can be
> disabled for targets where the uploading of only disk image is
> necessary.
> 
> As per the requirement, only disk image upload is sufficient for security
> image. So the EXTRA_ARTIFACT is disabled for the targets involving
> security extension.
> 
> Signed-off-by: Sai <Sai.Sathujoda@toshiba-tsip.com>
> ---
>  .gitlab-ci.yml             |  6 +++++-
>  scripts/deploy-cip-core.sh | 31 +++++++++++++++++--------------
>  2 files changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 8ccd617..f1308ee 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -25,6 +25,7 @@ variables:
>    dtb: none
>    deploy: enable
>    deploy_kernelci: disable
> +  extra_artifact: enable
>  
>  stages:
>    - build
> @@ -60,7 +61,7 @@ default:
>      - if [ "${encrypt}" = "enable" ]; then base_yaml="${base_yaml}:kas/opt/encrypt-partitions.yml"; fi
>      - echo "Building ${base_yaml}"
>      - kas build ${base_yaml}
> -    - if [ "${deploy}" = "enable" ]; then scripts/deploy-cip-core.sh ${release} ${target} ${extension} ${dtb} ${CI_COMMIT_REF_SLUG}; fi
> +    - if [ "${deploy}" = "enable" ]; then scripts/deploy-cip-core.sh ${release} ${target} ${extension} ${dtb} ${CI_COMMIT_REF_SLUG} ${extra_artifact}; fi
>      - if [ "${deploy_kernelci}" = "enable" ]; then scripts/deploy-kernelci.py ${release} ${target} ${extension} ${dtb}; fi
>  
>  # base image
> @@ -100,6 +101,7 @@ build:qemu-amd64-base:
>      use_rt: disable
>      wic_targz: disable
>      targz: enable
> +    extra_artifact: disable
>  
>  build:qemu-amd64-base-kernelci:
>    extends:
> @@ -122,6 +124,7 @@ build:qemu-arm64-base:
>      use_rt: disable
>      wic_targz: disable
>      targz: enable
> +    extra_artifact: disable
>  
>  build:qemu-arm64-base-kernelci:
>    extends:
> @@ -144,6 +147,7 @@ build:qemu-arm-base:
>      use_rt: disable
>      wic_targz: disable
>      targz: enable
> +    extra_artifact: disable
>  
>  build:qemu-arm-base-kernelci:
>    extends:
> diff --git a/scripts/deploy-cip-core.sh b/scripts/deploy-cip-core.sh
> index eaa8974..76e80ce 100755
> --- a/scripts/deploy-cip-core.sh
> +++ b/scripts/deploy-cip-core.sh
> @@ -15,6 +15,7 @@ TARGET=$2
>  EXTENSION=$3
>  DTB=$4
>  REF=$5
> +EXTRA_ARTIFACT=$6
>  
>  BASE_FILENAME=cip-core-image-cip-core-$RELEASE-$TARGET
>  if [ "${EXTENSION}" != "none" ]; then
> @@ -36,20 +37,22 @@ if [ -f "${BASE_PATH}.wic" ]; then
>  	aws s3 cp --no-progress --acl public-read "${BASE_PATH}.wic.xz" "${S3_TARGET}"
>  fi
>  
> -if [ -f "${BASE_PATH}.tar.gz" ]; then
> -	echo "Uploading artifacts..."
> -	aws s3 cp --no-progress --acl public-read "${BASE_PATH}.tar.gz" "${S3_TARGET}"
> -fi
> +if [ ${EXTRA_ARTIFACT} == "enable" ]; then

So, the logic is now:
 - deploy wic image if it exists
 - deploy rootfs tarball, kernel, etc. if EXTRA_ARTIFACT is enabled

I'm wondering if we have a case were both are true or if we could simply do

if exists wic
   deploy wic
else
   deploy tarball, kernel, etc.
endif

Would simplify the configuration back in .gitlab-ci.yaml

Jan

> +	if [ -f "${BASE_PATH}.tar.gz" ]; then
> +		echo "Uploading artifacts..."
> +		aws s3 cp --no-progress --acl public-read "${BASE_PATH}.tar.gz" "${S3_TARGET}"
> +	fi
>  
> -KERNEL_IMAGE="$BASE_PATH-vmlinu[xz]"
> -# iwg20m workaround
> -if [ -f "build/tmp/deploy/images/$TARGET/zImage" ]; then
> -	KERNEL_IMAGE=build/tmp/deploy/images/$TARGET/zImage
> -fi
> -# shellcheck disable=SC2086
> -aws s3 cp --no-progress --acl public-read $KERNEL_IMAGE "${S3_TARGET}"
> -aws s3 cp --no-progress --acl public-read "${BASE_PATH}-initrd.img" "${S3_TARGET}"
> +	KERNEL_IMAGE="$BASE_PATH-vmlinu[xz]"
> +	# iwg20m workaround
> +	if [ -f "build/tmp/deploy/images/$TARGET/zImage" ]; then
> +		KERNEL_IMAGE=build/tmp/deploy/images/$TARGET/zImage
> +	fi
> +	# shellcheck disable=SC2086
> +	aws s3 cp --no-progress --acl public-read $KERNEL_IMAGE "${S3_TARGET}"
> +	aws s3 cp --no-progress --acl public-read "${BASE_PATH}-initrd.img" "${S3_TARGET}"
>  
> -if [ "$DTB" != "none" ]; then
> -	aws s3 cp --no-progress --acl public-read build/tmp/deploy/images/*/"$DTB" "${S3_TARGET}"
> +	if [ "$DTB" != "none" ]; then
> +		aws s3 cp --no-progress --acl public-read build/tmp/deploy/images/*/"$DTB" "${S3_TARGET}"
> +	fi
>  fi
diff mbox series

Patch

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8ccd617..f1308ee 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -25,6 +25,7 @@  variables:
   dtb: none
   deploy: enable
   deploy_kernelci: disable
+  extra_artifact: enable
 
 stages:
   - build
@@ -60,7 +61,7 @@  default:
     - if [ "${encrypt}" = "enable" ]; then base_yaml="${base_yaml}:kas/opt/encrypt-partitions.yml"; fi
     - echo "Building ${base_yaml}"
     - kas build ${base_yaml}
-    - if [ "${deploy}" = "enable" ]; then scripts/deploy-cip-core.sh ${release} ${target} ${extension} ${dtb} ${CI_COMMIT_REF_SLUG}; fi
+    - if [ "${deploy}" = "enable" ]; then scripts/deploy-cip-core.sh ${release} ${target} ${extension} ${dtb} ${CI_COMMIT_REF_SLUG} ${extra_artifact}; fi
     - if [ "${deploy_kernelci}" = "enable" ]; then scripts/deploy-kernelci.py ${release} ${target} ${extension} ${dtb}; fi
 
 # base image
@@ -100,6 +101,7 @@  build:qemu-amd64-base:
     use_rt: disable
     wic_targz: disable
     targz: enable
+    extra_artifact: disable
 
 build:qemu-amd64-base-kernelci:
   extends:
@@ -122,6 +124,7 @@  build:qemu-arm64-base:
     use_rt: disable
     wic_targz: disable
     targz: enable
+    extra_artifact: disable
 
 build:qemu-arm64-base-kernelci:
   extends:
@@ -144,6 +147,7 @@  build:qemu-arm-base:
     use_rt: disable
     wic_targz: disable
     targz: enable
+    extra_artifact: disable
 
 build:qemu-arm-base-kernelci:
   extends:
diff --git a/scripts/deploy-cip-core.sh b/scripts/deploy-cip-core.sh
index eaa8974..76e80ce 100755
--- a/scripts/deploy-cip-core.sh
+++ b/scripts/deploy-cip-core.sh
@@ -15,6 +15,7 @@  TARGET=$2
 EXTENSION=$3
 DTB=$4
 REF=$5
+EXTRA_ARTIFACT=$6
 
 BASE_FILENAME=cip-core-image-cip-core-$RELEASE-$TARGET
 if [ "${EXTENSION}" != "none" ]; then
@@ -36,20 +37,22 @@  if [ -f "${BASE_PATH}.wic" ]; then
 	aws s3 cp --no-progress --acl public-read "${BASE_PATH}.wic.xz" "${S3_TARGET}"
 fi
 
-if [ -f "${BASE_PATH}.tar.gz" ]; then
-	echo "Uploading artifacts..."
-	aws s3 cp --no-progress --acl public-read "${BASE_PATH}.tar.gz" "${S3_TARGET}"
-fi
+if [ ${EXTRA_ARTIFACT} == "enable" ]; then
+	if [ -f "${BASE_PATH}.tar.gz" ]; then
+		echo "Uploading artifacts..."
+		aws s3 cp --no-progress --acl public-read "${BASE_PATH}.tar.gz" "${S3_TARGET}"
+	fi
 
-KERNEL_IMAGE="$BASE_PATH-vmlinu[xz]"
-# iwg20m workaround
-if [ -f "build/tmp/deploy/images/$TARGET/zImage" ]; then
-	KERNEL_IMAGE=build/tmp/deploy/images/$TARGET/zImage
-fi
-# shellcheck disable=SC2086
-aws s3 cp --no-progress --acl public-read $KERNEL_IMAGE "${S3_TARGET}"
-aws s3 cp --no-progress --acl public-read "${BASE_PATH}-initrd.img" "${S3_TARGET}"
+	KERNEL_IMAGE="$BASE_PATH-vmlinu[xz]"
+	# iwg20m workaround
+	if [ -f "build/tmp/deploy/images/$TARGET/zImage" ]; then
+		KERNEL_IMAGE=build/tmp/deploy/images/$TARGET/zImage
+	fi
+	# shellcheck disable=SC2086
+	aws s3 cp --no-progress --acl public-read $KERNEL_IMAGE "${S3_TARGET}"
+	aws s3 cp --no-progress --acl public-read "${BASE_PATH}-initrd.img" "${S3_TARGET}"
 
-if [ "$DTB" != "none" ]; then
-	aws s3 cp --no-progress --acl public-read build/tmp/deploy/images/*/"$DTB" "${S3_TARGET}"
+	if [ "$DTB" != "none" ]; then
+		aws s3 cp --no-progress --acl public-read build/tmp/deploy/images/*/"$DTB" "${S3_TARGET}"
+	fi
 fi