File tree 2 files changed +59
-2
lines changed
2 files changed +59
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : ' Parent Images: Matrix'
2
+
3
+ on :
4
+ workflow_call :
5
+ inputs :
6
+ parent_image_type :
7
+ description : ' If specified, "include" only outputs apps associated to this parent image type'
8
+ required : false
9
+ type : string
10
+ default : ' '
11
+ outputs :
12
+ parent_image_type :
13
+ description : ' List[str] of parent image types'
14
+ value : ${{ jobs.pi-matrix.outputs.parent_image_type }}
15
+ include :
16
+ description : ' List[Dict] of apps associated to parent image types'
17
+ value : ${{ jobs.pi-matrix.outputs.include }}
18
+
19
+ jobs :
20
+ pi-matrix :
21
+ name : ' Parent Images: Generate Matrix'
22
+ runs-on : ubuntu-latest
23
+ environment : dev
24
+ env :
25
+ PYTHON_VERSION : ${{ vars.PYTHON_VERSION }}
26
+ outputs :
27
+ parent_image_type : ${{ steps.generate-matrix.outputs.parent_image_type }}
28
+ include : ${{ steps.generate-matrix.outputs.include }}
29
+ steps :
30
+ - name : Checkout Repository
31
+ uses : actions/checkout@v4
32
+ with :
33
+ repository : ${{ github.repository_owner }}/refinery-submodule-parent-images
34
+ ref : ${{ github.event.pull_request.head.ref }}
35
+
36
+ - name : GitHub Configuration
37
+ run : git config --global url."https://oauth2:${{ secrets.GH_TOKEN }}@github.com".insteadOf https://github.com
38
+
39
+ - name : Clone cicd-deployment-scripts
40
+ run : git clone --branch parent-images https://github.com/code-kern-ai/cicd-deployment-scripts.git
41
+
42
+ - name : Generate Matrix
43
+ id : generate-matrix
44
+ run : |
45
+ bash cicd-deployment-scripts/pi/matrix.sh \
46
+ -p "${{ github.event.pull_request.number }}" \
47
+ -s cicd-deployment-scripts/pi/settings.sh \
48
+ -t "${{ inputs.parent_image_type }}"
Original file line number Diff line number Diff line change 2
2
3
3
set -e
4
4
5
+ PARENT_IMAGE_TYPE=" "
5
6
PR_NUMBER=" "
6
7
SOURCE_SCRIPT=" pi/settings.sh"
7
8
8
- while getopts p:s: flag
9
+ while getopts t: p:s: flag
9
10
do
10
11
case " ${flag} " in
12
+ t) PARENT_IMAGE_TYPE=${OPTARG} ;;
11
13
p) PR_NUMBER=${OPTARG} ;;
12
14
s) SOURCE_SCRIPT=${OPTARG} ;;
13
15
esac
@@ -27,8 +29,14 @@ while IFS= read -r file; do
27
29
28
30
done <<< " $UPDATED_FILES"
29
31
32
+ if [ -n $PARENT_IMAGE_TYPE ]; then
33
+ UPDATED_PARENT_TYPES=( $PARENT_IMAGE_TYPE )
34
+ fi
35
+
36
+ PARENT_IMAGE_TYPES=" "
30
37
INCLUDES=" "
31
38
for parent_image_type in " ${UPDATED_PARENT_TYPES[@]} " ; do
39
+ PARENT_IMAGE_TYPES+=" \" $parent_image_type \" ,"
32
40
eval ' APP_REPOS=( "${' $( echo ${parent_image_type} | sed " s|-|_|g" ) ' [@]}" )'
33
41
for app in " ${APP_REPOS[@]} " ; do
34
42
INCLUDES+=' { "parent_image_type": "' ${parent_image_type} ' ", "app": "' ${app} ' " },'
37
45
38
46
MATRIX=' {"include": [' ${INCLUDES::- 1} ' ]}'
39
47
echo $MATRIX | jq -C --indent 2 ' .'
40
- echo " include=[${INCLUDES::- 1} ]" >> $GITHUB_OUTPUT
48
+ echo " include=[${INCLUDES::- 1} ]" >> $GITHUB_OUTPUT
49
+ echo " parent_image_type=[${PARENT_IMAGE_TYPES::- 1} ]" >> $GITHUB_OUTPUT
You can’t perform that action at this time.
0 commit comments