From 5a1cda7cd8e0541bc75c8633c97631a6c9c739d3 Mon Sep 17 00:00:00 2001
From: Lorenzo Pagliai <lorenzo.pagliai@seco.com>
Date: Wed, 22 Feb 2023 13:41:02 +0100
Subject: [PATCH] [DOCKER USER] Add docker user to edgehog group

* This is necessary to guarantee write access to edgehog folder in build
server containing sstate and downloads caches
* Move env initizialization to .initenv
* Reduce build artifacts expiration time to 1 week
---
 manifest-pipeline-yocto.yml | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/manifest-pipeline-yocto.yml b/manifest-pipeline-yocto.yml
index ea13ba3..6e8e9a2 100644
--- a/manifest-pipeline-yocto.yml
+++ b/manifest-pipeline-yocto.yml
@@ -152,6 +152,16 @@ retrigger:
 ########## BUILD ############
 #############################
 
+.initENV: &initENV
+  - NEWUS='secous'
+  - groupadd $NEWUS -g 1002 
+  - /usr/bin/restrict_useradd.sh 1002 1002 $NEWUS
+  - groupadd edgehog -g 1023
+  - usermod -a -G edgehog $NEWUS
+  - chown -R :edgehog /var/cache/edgehog_downloads /var/cache/edgehog_sstate
+  - chsh -s /bin/bash $NEWUS
+  - su $NEWUS
+
 .build:
   extends:
     - .infrastructure
@@ -169,8 +179,8 @@ retrigger:
   cache: {}
   retry : 2
   before_script:
-     - NEWUS='secous'; groupadd $NEWUS -g 1002; /usr/bin/restrict_useradd.sh 1002 1002 $NEWUS; chsh -s /bin/bash $NEWUS; su $NEWUS
-  
+      - *initENV
+
   script:
       # init repository and generate configuration files for bitbake
       # checkout
@@ -233,7 +243,7 @@ retrigger:
         fi
 
   artifacts:
-     expire_in: 4 weeks
+     expire_in: 1 week
      paths:
       - $BUILD_DIRECTORY/$IMAGES_PATH/$MACHINE/
       - pathname.txt
-- 
GitLab