Skip to content

Commit

Permalink
skip: Merge pull request #108 from epam/defender_separate
Browse files Browse the repository at this point in the history
upd auto-test ci, add isolated
  • Loading branch information
anna-shcherbak authored Sep 27, 2024
2 parents 308ac42 + 9ff96da commit 820054a
Showing 1 changed file with 43 additions and 5 deletions.
48 changes: 43 additions & 5 deletions .github/workflows/auto-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ on:
push:
branches:
- "feature/auto_policy_testing"
- "defender_separate"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
resource_priority_list:
type: string
description: Priority list for resources (you can remove unnecessary resources during testing)
default: '["storage", "webapp", "vnet", "network", "vm", "synapse", "sql", "mysql", "subscription", "disk", "postgresql", "cosmosdb", "signalr", "spring", "search", "service-fabric", "stream", "redis", "servicebus", "role", "monitor", "machine-learning", "logic", "kusto", "aks", "keyvault", "iothub", "front-door", "event", "data", "defender", "container", "cognitiveservice", "batch", "automation", "application", "app-configuration", "api", "alert"]'
default: ''
#'["storage", "webapp", "vnet", "network", "vm", "synapse", "sql", "mysql", "subscription", "disk", "postgresql", "cosmosdb", "signalr", "spring", "search", "service-fabric", "stream", "redis", "servicebus", "role", "monitor", "machine-learning", "logic", "kusto", "aks", "keyvault", "iothub", "front-door", "event", "data", "defender", "container", "cognitiveservice", "batch", "automation", "application", "app-configuration", "api", "alert"]'
required: true

Expand All @@ -24,7 +25,7 @@ env:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_SECRET_VALUE: ${{ secrets.AZURE_SECRET_VALUE }}
default_resource_priority_list: '["storage", "webapp", "vnet", "network", "vm", "synapse", "sql", "mysql", "subscription", "disk", "postgresql", "cosmosdb", "signalr", "spring", "search", "service-fabric", "stream", "redis", "servicebus", "role", "monitor", "machine-learning", "logic", "kusto", "aks", "keyvault", "iothub", "front-door", "event", "data", "defender", "container", "cognitiveservice", "batch", "automation", "application", "app-configuration", "api", "alert"]'
default_resource_priority_list: '["storage", "sql", "defender"]'
#default_resource_priority_list: '["storage", "webapp", "vnet", "network", "vm", "synapse", "sql", "mysql", "subscription", "disk", "postgresql", "cosmosdb", "signalr", "spring", "search", "service-fabric", "stream", "redis", "servicebus", "role", "monitor", "machine-learning", "logic", "kusto", "aks", "keyvault", "iothub", "front-door", "event", "data", "defender", "container", "cognitiveservice", "batch", "automation", "application", "app-configuration", "api", "alert"]'
TF_VAR_project: ${{ secrets.TF_VAR_project }}
TF_VAR_region: ${{ secrets.AWS_REGION }}
Expand Down Expand Up @@ -107,6 +108,7 @@ jobs:
parallel_resources_list: ${{ steps.prepare-resource-matrix.outputs.parallel_resources_to_scan }}
not_parallel_resources_list: ${{ steps.prepare-resource-matrix.outputs.not_parallel_resources_to_scan }}
sequential_resources_list: ${{ steps.prepare-resource-matrix.outputs.sequential_resources_to_scan }}
isolated_resources_list: ${{ steps.prepare-resource-matrix.outputs.isolated_resources_to_scan }}
sequential_resources_length: ${{ steps.prepare-resource-matrix.outputs.sequential_resources_length }}
steps:
- name: Git clone the repository
Expand All @@ -121,11 +123,46 @@ jobs:
- name: Prepare resource matrix
id: prepare-resource-matrix
uses: ./ecc-actions/auto-test-actions/prepare-resource-matrix
with:
RESOURCE_PRIORITY_LIST: ${{ github.event.inputs.resource_priority_list }}

deploy_and_scan_isolated_resources:
name: Scan I N/P
runs-on: ubuntu-22.04
needs: [ deploy_common_resources, prepare_resource_matrix ]
if: ${{ needs.prepare_resource_matrix.outputs.isolated_resources_list != '[]' }}
strategy:
max-parallel: 1
fail-fast: false
matrix:
compliance: ['green', 'red']
resource: ${{fromJson(needs.prepare_resource_matrix.outputs.isolated_resources_list)}}
env:
COMPLINCE: ${{ matrix.compliance }}
RESOURCE: ${{ matrix.resource }}

steps:
- name: Git clone the repository
uses: actions/checkout@v4

- name: Checkout ecc-actions
run: git clone -b $ACTIONS_REPO_BRANCH "https://git:[email protected]/epmc-sec/cloudlab/cloud_custodian/ecc-actions.git" ecc-actions
env:
PROJECT_TOKEN: ${{ secrets.ECC_CHANGELOG_ACTION }}
ACTIONS_REPO_BRANCH: ${{ env.ACTIONS_REPO_BRANCH }}

- name: Deploy and scan parallel resources
uses: ./ecc-actions/auto-test-actions/deploy-and-scan-resources
with:
CI_ASSUME_ROLE: ${{ secrets.CI_ASSUME_ROLE }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
COMPLIANCE: ${{ matrix.compliance }}
PROJECT_TOKEN: ${{ secrets.CLOUDCUSTODIAN_CORE }}

deploy_and_scan_parallel_resources:
name: Scan P
runs-on: ubuntu-22.04
needs: [ deploy_common_resources, prepare_resource_matrix ]
needs: [ deploy_common_resources, prepare_resource_matrix, deploy_and_scan_isolated_resources ]
if: ${{ needs.prepare_resource_matrix.outputs.parallel_resources_list != '[]' }}
strategy:
max-parallel: 10
Expand Down Expand Up @@ -159,7 +196,7 @@ jobs:
deploy_and_scan_not_parallel_resources:
name: Scan N/P
runs-on: ubuntu-22.04
needs: [ deploy_common_resources, prepare_resource_matrix]
needs: [ deploy_common_resources, prepare_resource_matrix, deploy_and_scan_isolated_resources]
if: ${{ needs.prepare_resource_matrix.outputs.not_parallel_resources_list != '[]' }}
strategy:
max-parallel: 1
Expand Down Expand Up @@ -192,9 +229,10 @@ jobs:
deploy_and_scan_sequential_resources:
name: Scan S
runs-on: ubuntu-22.04
needs: [deploy_common_resources, prepare_resource_matrix]
needs: [deploy_common_resources, prepare_resource_matrix, deploy_and_scan_isolated_resources]
if: ${{ needs.prepare_resource_matrix.outputs.sequential_resources_list != '[]' }}
strategy:
max-parallel: 7
fail-fast: false
matrix:
resource: ${{fromJson(needs.prepare_resource_matrix.outputs.sequential_resources_list)}}
Expand Down

0 comments on commit 820054a

Please sign in to comment.