File tree Expand file tree Collapse file tree 2 files changed +59
-2
lines changed
Expand file tree Collapse file tree 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 22
33set -e
44
5+ PARENT_IMAGE_TYPE=" "
56PR_NUMBER=" "
67SOURCE_SCRIPT=" pi/settings.sh"
78
8- while getopts p:s: flag
9+ while getopts t: p:s: flag
910do
1011 case " ${flag} " in
12+ t) PARENT_IMAGE_TYPE=${OPTARG} ;;
1113 p) PR_NUMBER=${OPTARG} ;;
1214 s) SOURCE_SCRIPT=${OPTARG} ;;
1315 esac
@@ -27,8 +29,14 @@ while IFS= read -r file; do
2729
2830done <<< " $UPDATED_FILES"
2931
32+ if [ -n $PARENT_IMAGE_TYPE ]; then
33+ UPDATED_PARENT_TYPES=( $PARENT_IMAGE_TYPE )
34+ fi
35+
36+ PARENT_IMAGE_TYPES=" "
3037INCLUDES=" "
3138for parent_image_type in " ${UPDATED_PARENT_TYPES[@]} " ; do
39+ PARENT_IMAGE_TYPES+=" \" $parent_image_type \" ,"
3240 eval ' APP_REPOS=( "${' $( echo ${parent_image_type} | sed " s|-|_|g" ) ' [@]}" )'
3341 for app in " ${APP_REPOS[@]} " ; do
3442 INCLUDES+=' { "parent_image_type": "' ${parent_image_type} ' ", "app": "' ${app} ' " },'
3745
3846MATRIX=' {"include": [' ${INCLUDES::- 1} ' ]}'
3947echo $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