2828 # ========================================
2929 RUN_TESTS : " false" # Usually disabled in dev for speed
3030 RUN_SONARQUBE : " true" # Enable for testing the new dotnet-coverage integration
31+ RUN_SCA_SCAN : " true" # Enable SCA Scan
3132
3233 # ========================================
3334 # Tag Stategy for Build and GitOps
5455 cluster_name : ${{ steps.config.outputs.cluster_name }}
5556 environment : ${{ steps.config.outputs.environment }}
5657 load_custom_vars : ${{ steps.config.outputs.load_custom_vars }}
58+ project_name : ${{ steps.config.outputs.project_name }}
59+ project_version : ${{ steps.config.outputs.project_version }}
5760 run_tests : ${{ steps.config.outputs.run_tests }}
5861 run_sonarqube : ${{ steps.config.outputs.run_sonarqube }}
62+ run_sca_scan : ${{ steps.config.outputs.run_sca_scan }}
5963 service_name : ${{ steps.config.outputs.service_name }} # e.g., your service name
6064 service_type : ${{ steps.config.outputs.service_type }} # e.g., webclient, webservice, winservice
6165 sonarqube_host : ${{ steps.config.outputs.sonarqube_host }} # e.g., https://code.selise.biz
9195 echo "cluster_name=${{ env.CLUSTER_NAME }}" >> $GITHUB_OUTPUT
9296 echo "load_custom_vars=${{ env.LOAD_CUSTOM_VARS }}" >> $GITHUB_OUTPUT
9397 echo "tag_strategy=${{ env.TAG_STRATEGY }}" >> $GITHUB_OUTPUT
98+ echo "run_sca_scan=${{ env.RUN_SCA_SCAN }}" >> $GITHUB_OUTPUT
9499
95100 # From vars.env (if loaded) or fallback to defaults
96101 echo "dockerfile_path=${DOCKERFILE:-./Dockerfile}" >> $GITHUB_OUTPUT
@@ -104,6 +109,11 @@ jobs:
104109 echo "package_manager=${PACKAGE_MANAGER:-npm}" >> $GITHUB_OUTPUT
105110 echo "node_version=${NODE_VERSION:-21}" >> $GITHUB_OUTPUT
106111
112+ # Project configuration for SCA Scan
113+ echo "project_name=${PROJECT_NAME:-${{ github.event.repository.name }}}" >> $GITHUB_OUTPUT
114+ echo "project_version=${PROJECT_VERSION:-${{ github.ref_name }}}" >> $GITHUB_OUTPUT
115+ echo "dependency_track_host=${DEPENDENCY_TRACK_HOST:-api-dt.seliseblocks.com}" >> $GITHUB_OUTPUT
116+
107117 # SonarQube specific configurations (map from vars.env names)
108118 echo "sonar_project_key=${SONAR_KEY:-}" >> $GITHUB_OUTPUT
109119 echo "sonar_organization=${AUTHOR:-}" >> $GITHUB_OUTPUT
@@ -203,47 +213,89 @@ jobs:
203213 # secrets:
204214 # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_GLOBAL }}
205215
206- # # Build and push image
207- # build:
208- # needs: [initialization, sonarqube]
209- # if: ${{ github.event_name == 'push' && (success() || needs.sonarqube.result == 'skipped' ) }}
210- # uses: ./.github/workflows/build-push.yml
211- # with:
212- # SERVICE_NAME: ${{ needs.initialization.outputs.service_name }}
213- # # SERVICE_TYPE: ${{ needs.initialization.outputs.service_type }}
214- # SERVICE_TYPE: "webservice" # e.g., webclient, webservice, winservice
215- # ENVIRONMENT: ${{ needs.initialization.outputs.environment }}
216- # TAG_STRATEGY: ${{ needs.initialization.outputs.tag_strategy }} # Options: "both" (default), "semantic", "commit"
217- # DOCKERFILE_PATH: ${{ needs.initialization.outputs.dockerfile_path }}
218- # VERSION: ${{ needs.initialization.outputs.version }} # Optional: Comment out to skip version suffix
219- # BUILD_ARGS: |
220- # ci_build=dev
221- # secrets:
222- # AZURE_CREDENTIALS: ${{ secrets.AZURE_AKS_BLOCKS_CREDENTIALS }}
223- # AZURE_CONTAINER_REGISTRY: ${{ secrets.AZURE_BLOCKS_CONTAINER_REGISTRY }}
224- # ACR_RESOURCE_GROUP: ${{ secrets.ClUSTER_AKS_BLOCKS_RESOURCE_GROUP }}
225- # SELISE_GITHUB_PAT: ${{ secrets.SELISE_GITHUB_PAT }}
226-
227- # # Update GitOps repository
228- # update-gitops:
229- # needs: [initialization, build]
230- # if: |
231- # github.event_name == 'push' &&
232- # always() &&
233- # needs.initialization.result == 'success' &&
234- # needs.build.result == 'success'
235- # uses: ./.github/workflows/update-gitops.yml
236- # with:
237- # SERVICE_NAME: ${{ needs.initialization.outputs.service_name }}
238- # SERVICE_TYPE: "webservice" # Match the service type from build job
239- # ENVIRONMENT: ${{ needs.initialization.outputs.environment }}
240- # VERSION: ${{ needs.initialization.outputs.version }} # Pass version for proper file naming
241- # IMAGE_TAG: ${{ needs.build.outputs.image_tag }}
242- # COMMIT_TAG: ${{ needs.build.outputs.commit_tag }}
243- # SEMANTIC_TAG: ${{ needs.build.outputs.semantic_tag }}
244- # TAG_STRATEGY: ${{ needs.initialization.outputs.tag_strategy }} # Options: "commit" (default), "semantic", or "primary"
245- # CLUSTER_NAME: ${{ needs.initialization.outputs.cluster_name }}
246- # # GITOPS_BRANCH: "main"
247- # secrets:
248- # SELISE_GITHUB_PAT: ${{ secrets.SELISE_GITHUB_PAT }}
249- # AZURE_CONTAINER_REGISTRY: ${{ secrets.AZURE_BLOCKS_CONTAINER_REGISTRY }}
216+ # ==============================================
217+ # SCA Scan - Pass variables as inputs
218+ # ==============================================
219+ sca-scan :
220+ if : needs.initialization.outputs.run_sca_scan == 'true'
221+ needs : [initialization]
222+ uses : ./.github/workflows/sca-scan-js-recommended.yml
223+ with :
224+ # Project Configuration
225+ PROJECT_NAME : ${{ needs.initialization.outputs.project_name }}
226+ PROJECT_VERSION : ${{ needs.initialization.outputs.project_version }}
227+
228+ # Node Configuration
229+ NODE_VERSION : ${{ needs.initialization.outputs.node_version }}
230+ PACKAGE_MANAGER : ${{ needs.initialization.outputs.package_manager }}
231+ INSTALL_COMMAND : " ci"
232+
233+ # Dependency-Track Configuration
234+ DEPENDENCY_TRACK_HOST : ${{ needs.initialization.outputs.dependency_track_host }}
235+ AUTO_CREATE_PROJECT : true
236+ ARTIFACT_RETENTION_DAYS : 7
237+
238+ # Optional Features
239+ HAS_SUBMODULES : ${{ needs.initialization.outputs.has_submodules == 'true' }}
240+
241+ secrets :
242+ DEPENDENCY_TRACK_API_KEY : ${{ secrets.DEPENDENCY_TRACK_API_KEY }}
243+ SELISE_GITHUB_PAT : ${{ secrets.SELISE_GITHUB_PAT }}
244+ # ==============================================
245+ # ALTERNATIVE: Simple Direct Passing (No Init Job)
246+ # ==============================================
247+ # If you don't need vars.env, you can pass values directly:
248+ #
249+ # jobs:
250+ # sca-scan:
251+ # uses: ./.github/workflows/sca-scan-js-recommended.yml
252+ # with:
253+ # PROJECT_NAME: "my-project"
254+ # DEPENDENCY_TRACK_HOST: "api-dt.seliseblocks.com"
255+ # secrets:
256+ # DEPENDENCY_TRACK_API_KEY: ${{ secrets.DEPENDENCY_TRACK_API_KEY }}
257+
258+ # # Build and push image
259+ # build:
260+ # needs: [initialization, sonarqube]
261+ # if: ${{ github.event_name == 'push' && (success() || needs.sonarqube.result == 'skipped' ) }}
262+ # uses: ./.github/workflows/build-push.yml
263+ # with:
264+ # SERVICE_NAME: ${{ needs.initialization.outputs.service_name }}
265+ # # SERVICE_TYPE: ${{ needs.initialization.outputs.service_type }}
266+ # SERVICE_TYPE: "webservice" # e.g., webclient, webservice, winservice
267+ # ENVIRONMENT: ${{ needs.initialization.outputs.environment }}
268+ # TAG_STRATEGY: ${{ needs.initialization.outputs.tag_strategy }} # Options: "both" (default), "semantic", "commit"
269+ # DOCKERFILE_PATH: ${{ needs.initialization.outputs.dockerfile_path }}
270+ # VERSION: ${{ needs.initialization.outputs.version }} # Optional: Comment out to skip version suffix
271+ # BUILD_ARGS: |
272+ # ci_build=dev
273+ # secrets:
274+ # AZURE_CREDENTIALS: ${{ secrets.AZURE_AKS_BLOCKS_CREDENTIALS }}
275+ # AZURE_CONTAINER_REGISTRY: ${{ secrets.AZURE_BLOCKS_CONTAINER_REGISTRY }}
276+ # ACR_RESOURCE_GROUP: ${{ secrets.ClUSTER_AKS_BLOCKS_RESOURCE_GROUP }}
277+ # SELISE_GITHUB_PAT: ${{ secrets.SELISE_GITHUB_PAT }}
278+
279+ # # Update GitOps repository
280+ # update-gitops:
281+ # needs: [initialization, build]
282+ # if: |
283+ # github.event_name == 'push' &&
284+ # always() &&
285+ # needs.initialization.result == 'success' &&
286+ # needs.build.result == 'success'
287+ # uses: ./.github/workflows/update-gitops.yml
288+ # with:
289+ # SERVICE_NAME: ${{ needs.initialization.outputs.service_name }}
290+ # SERVICE_TYPE: "webservice" # Match the service type from build job
291+ # ENVIRONMENT: ${{ needs.initialization.outputs.environment }}
292+ # VERSION: ${{ needs.initialization.outputs.version }} # Pass version for proper file naming
293+ # IMAGE_TAG: ${{ needs.build.outputs.image_tag }}
294+ # COMMIT_TAG: ${{ needs.build.outputs.commit_tag }}
295+ # SEMANTIC_TAG: ${{ needs.build.outputs.semantic_tag }}
296+ # TAG_STRATEGY: ${{ needs.initialization.outputs.tag_strategy }} # Options: "commit" (default), "semantic", or "primary"
297+ # CLUSTER_NAME: ${{ needs.initialization.outputs.cluster_name }}
298+ # # GITOPS_BRANCH: "main"
299+ # secrets:
300+ # SELISE_GITHUB_PAT: ${{ secrets.SELISE_GITHUB_PAT }}
301+ # AZURE_CONTAINER_REGISTRY: ${{ secrets.AZURE_BLOCKS_CONTAINER_REGISTRY }}
0 commit comments