|
38 | 38 | required: false |
39 | 39 | type: boolean |
40 | 40 | default: false |
| 41 | + cache_version_suffix: |
| 42 | + description: 'Optional cache version suffix (e.g., "test", "debug") - creates separate cache namespace' |
| 43 | + required: false |
| 44 | + type: string |
| 45 | + default: '' |
| 46 | + apps_to_rebuild: |
| 47 | + description: 'Comma-separated list of specific apps to rebuild (e.g., "app1,app2") - ignores cache for these apps only' |
| 48 | + required: false |
| 49 | + type: string |
| 50 | + default: '' |
41 | 51 |
|
42 | 52 | concurrency: |
43 | 53 | group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/ionos-dev' && github.run_id || github.event.pull_request.number || github.ref }} |
|
66 | 76 | apps_sha_map: ${{ steps.detect.outputs.apps_sha_map }} |
67 | 77 | has_apps_to_build: ${{ steps.detect.outputs.has_apps_to_build }} |
68 | 78 | has_apps_to_restore: ${{ steps.detect.outputs.has_apps_to_restore }} |
| 79 | + effective_cache_version: ${{ steps.compute_cache_version.outputs.effective_cache_version }} |
69 | 80 | steps: |
| 81 | + - name: Compute effective cache version |
| 82 | + id: compute_cache_version |
| 83 | + run: | |
| 84 | + # Compute cache version with optional suffix to create a single source of truth |
| 85 | + EFFECTIVE_VERSION="${{ env.CACHE_VERSION }}${{ github.event.inputs.cache_version_suffix && format('-{0}', github.event.inputs.cache_version_suffix) || '' }}" |
| 86 | + echo "effective_cache_version=$EFFECTIVE_VERSION" >> "$GITHUB_OUTPUT" |
| 87 | + echo "Effective cache version: $EFFECTIVE_VERSION" |
| 88 | +
|
70 | 89 | - name: Checkout repository |
71 | 90 | uses: actions/checkout@v5 |
72 | 91 | with: |
@@ -182,14 +201,21 @@ jobs: |
182 | 201 | id: detect |
183 | 202 | env: |
184 | 203 | GH_TOKEN: ${{ github.token }} |
185 | | - CACHE_VERSION: ${{ env.CACHE_VERSION }} |
| 204 | + CACHE_VERSION: ${{ steps.compute_cache_version.outputs.effective_cache_version }} |
186 | 205 | FORCE_REBUILD: ${{ github.event.inputs.force_rebuild || 'false' }} |
| 206 | + APPS_TO_REBUILD: ${{ github.event.inputs.apps_to_rebuild || '' }} |
187 | 207 | JF_URL: ${{ secrets.JF_ARTIFACTORY_URL }} |
188 | 208 | JF_USER: ${{ secrets.JF_ARTIFACTORY_USER }} |
189 | 209 | JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }} |
190 | 210 | ARTIFACTORY_REPOSITORY_SNAPSHOT: ${{ env.ARTIFACTORY_REPOSITORY_SNAPSHOT }} |
191 | 211 | GITHUB_REF: ${{ github.ref }} |
192 | 212 | run: | |
| 213 | + # Show effective cache version |
| 214 | + echo "Base CACHE_VERSION: ${{ env.CACHE_VERSION }}" |
| 215 | + echo "Cache version suffix: ${{ github.event.inputs.cache_version_suffix || '(none)' }}" |
| 216 | + echo "Effective CACHE_VERSION: ${CACHE_VERSION}" |
| 217 | + echo "Apps to rebuild: ${{ github.event.inputs.apps_to_rebuild || '(none)' }}" |
| 218 | + echo "" |
193 | 219 | bash .github/scripts/detect-app-cache.sh '${{ steps.set_matrix.outputs.matrix }}' |
194 | 220 |
|
195 | 221 | build-external-apps: |
@@ -287,7 +313,7 @@ jobs: |
287 | 313 | uses: actions/cache/save@v4 |
288 | 314 | with: |
289 | 315 | path: ${{ steps.app-config.outputs.path }} |
290 | | - key: ${{ env.CACHE_VERSION }}-app-build-${{ matrix.app_info.name }}-${{ matrix.app_info.sha }} |
| 316 | + key: ${{ needs.prepare-matrix.outputs.effective_cache_version }}-app-build-${{ matrix.app_info.name }}-${{ matrix.app_info.sha }} |
291 | 317 |
|
292 | 318 | # Push to JFrog for ionos-dev branch builds |
293 | 319 | - name: Setup JFrog CLI |
@@ -319,11 +345,15 @@ jobs: |
319 | 345 | APP_SHA="${{ matrix.app_info.sha }}" |
320 | 346 | APP_PATH="${{ steps.app-config.outputs.path }}" |
321 | 347 |
|
| 348 | + # Use precomputed effective cache version |
| 349 | + EFFECTIVE_CACHE_VERSION="${{ needs.prepare-matrix.outputs.effective_cache_version }}" |
| 350 | +
|
322 | 351 | echo "=== JFrog Upload Debug Info ===" |
323 | 352 | echo "📦 Packaging $APP_NAME for JFrog upload..." |
324 | 353 | echo "App Name: $APP_NAME" |
325 | 354 | echo "App SHA: $APP_SHA" |
326 | 355 | echo "App Path: $APP_PATH" |
| 356 | + echo "Cache Version: $EFFECTIVE_CACHE_VERSION" |
327 | 357 | echo "Repository: ${{ env.ARTIFACTORY_REPOSITORY_SNAPSHOT }}" |
328 | 358 | echo "===============================" |
329 | 359 |
|
@@ -355,7 +385,7 @@ jobs: |
355 | 385 |
|
356 | 386 | # Upload to JFrog - store in snapshot repo under dev/apps/ |
357 | 387 | # Include CACHE_VERSION in path to enable complete cache invalidation |
358 | | - JFROG_PATH="${{ env.ARTIFACTORY_REPOSITORY_SNAPSHOT }}/apps/${{ env.CACHE_VERSION }}/${APP_NAME}/${ARCHIVE_NAME}" |
| 388 | + JFROG_PATH="${{ env.ARTIFACTORY_REPOSITORY_SNAPSHOT }}/apps/${EFFECTIVE_CACHE_VERSION}/${APP_NAME}/${ARCHIVE_NAME}" |
359 | 389 |
|
360 | 390 | # Build properties for artifact metadata |
361 | 391 | JFROG_PROPS_LIST=() |
@@ -1176,9 +1206,12 @@ jobs: |
1176 | 1206 | echo "" |
1177 | 1207 | echo "### Workflow Inputs (if workflow_dispatch)" |
1178 | 1208 | echo "Force Rebuild: ${{ github.event.inputs.force_rebuild || 'N/A' }}" |
| 1209 | + echo "Cache Version Suffix: ${{ github.event.inputs.cache_version_suffix || 'N/A' }}" |
| 1210 | + echo "Apps to Rebuild: ${{ github.event.inputs.apps_to_rebuild || 'N/A' }}" |
1179 | 1211 | echo "" |
1180 | 1212 | echo "### Environment Variables" |
1181 | | - echo "CACHE_VERSION: ${{ env.CACHE_VERSION }}" |
| 1213 | + echo "Base CACHE_VERSION: ${{ env.CACHE_VERSION }}" |
| 1214 | + echo "Effective CACHE_VERSION: ${{ needs.prepare-matrix.outputs.effective_cache_version }}" |
1182 | 1215 | echo "TARGET_PACKAGE_NAME: ${{ env.TARGET_PACKAGE_NAME }}" |
1183 | 1216 | echo "ARTIFACTORY_REPOSITORY_SNAPSHOT: ${{ env.ARTIFACTORY_REPOSITORY_SNAPSHOT }}" |
1184 | 1217 | echo "" |
|
0 commit comments