Skip to content

Commit

Permalink
Merge branch 'master' into v-prasadboke-AzureFuntion2Functions
Browse files Browse the repository at this point in the history
  • Loading branch information
v-prasadboke committed Sep 28, 2023
2 parents 95c71ec + be54b51 commit 23c9b0b
Show file tree
Hide file tree
Showing 322 changed files with 71,486 additions and 5,155 deletions.
8 changes: 4 additions & 4 deletions .azure-pipelines/callGithubWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ jobs:
$branchName = "$(System.PullRequest.SourceBranch)"
$targetBranch = "$(System.PullRequest.TargetBranch)"
$pullRequestNumber = "$(System.PullRequest.PullRequestNumber)"
$isAutoGeneratedPR = [bool]($branchName -match "-automated-pr")
Write-Host "BranchName is $branchName, pullRequestNumber $pullRequestNumber, isAutoGeneratedPR $isAutoGeneratedPR"
$isAutoGeneratedOrDependabotPR = [bool]($branchName -match "dependabot/|-automated-pr")
Write-Host "BranchName is $branchName, pullRequestNumber $pullRequestNumber, isAutoGeneratedOrDependabotPR $isAutoGeneratedOrDependabotPR"
# NOT MAIN/MASTER OR AUTOMATED BRANCH
if ($branchName -ne 'master' -and $isAutoGeneratedPR -eq $false -and $targetBranch -eq 'master')
if ($branchName -ne 'master' -and $isAutoGeneratedOrDependabotPR -eq $false -and $targetBranch -eq 'master')
{
# INVOKE GITHUB WORKFLOW
$header = @{
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
}
else
{
Write-Host "Skipping Github Workflow from execution as current branch is a Master branch or is a automated PR or target branch is not master."
Write-Host "Skipping Github Workflow from execution as current branch is a Master branch/Automated PR/Dependabot or target branch is not master."
}
}
catch
Expand Down
51 changes: 3 additions & 48 deletions .github/workflows/arm-ttk-validations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,54 +17,9 @@ jobs:
id: step1
name: Identify Changes in PR
run: |
$diff = git diff --diff-filter=d --name-only HEAD^ HEAD
Write-Host "List of files in PR: $diff"
$hasmainTemplateChanged = $false
$hasCreateUiDefinitionTemplateChanged = $false
$isChangeInSolutionsFolder = [bool]($diff | Where-Object {$_ -like 'Solutions/*'})
if (!$isChangeInSolutionsFolder)
{
Write-Host "Skipping as change is not in Solutions folder!"
exit 0
}
$requiredFiles = @("mainTemplate.json", "createUiDefinition.json")
$filteredFiles = $diff | Where-Object {$_ -match ($requiredFiles -Join "|")}
Write-Host "Filtered Files $filteredFiles"
if ($filteredFiles.Count -gt 0)
{
$mainTemplateValue = $filteredFiles -match "mainTemplate.json"
$createUiValue = $filteredFiles -match "createUiDefinition.json"
if ($mainTemplateValue)
{
$hasmainTemplateChanged = $true
}
if ($createUiValue)
{
$hasCreateUiDefinitionTemplateChanged = $true
}
if ($filteredFiles.Count -eq 1)
{
$packageIndex = $filteredFiles.IndexOf("/Package")
$sName = $filteredFiles.SubString(10, $packageIndex - 10)
}
else
{
$packageIndex = $filteredFiles[0].IndexOf("/Package")
$sName = $filteredFiles[0].SubString(10, $packageIndex - 10)
}
Write-Host "SolutionName: $sName"
}
Write-Output "::set-output name=solutionName::$sName"
Write-Output "::set-output name=mainTemplateChanged::$hasmainTemplateChanged"
Write-Output "::set-output name=createUiChanged::$hasCreateUiDefinitionTemplateChanged"
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module powershell-yaml
./.script/package-automation/arm-ttk-tests.ps1
- uses: docker/build-push-action@v2
id: publishGithubPackage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checkAutomatedPR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ permissions:
pull-requests: read

env:
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref && github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}
BODY: ${{ github.event.issue.body }}

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checkPRContentChange.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- "Solutions/**"

env:
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref && github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}

jobs:
solutionNameDetails:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/checkSkipPackagingInfo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
value: ${{ jobs.checkPackagingInfoStatus.outputs.isPackagingRequired }}

env:
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref && github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}

jobs:
checkPackagingInfoStatus:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/getSolutionName.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
value: ${{ jobs.currentPRSolutionName.outputs.sName }}

env:
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref && github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}

jobs:
currentPRSolutionName:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/neworexistingsolution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
value: ${{ jobs.masterDetails.outputs.solutionPublisherId }}

env:
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref && github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}
BRANCH_NAME: ${{ github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}

jobs:
masterDetails:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/package-command.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ env:
DEFAULTPACKAGEVERSION: "${{ vars.DEFAULTPACKAGEVERSION }}"
BLOB_CONN_STRING: "${{ secrets.BLOB_CONN_STRING }}"
BASE_FOLDER_PATH: "${{ vars.BASEFOLDERPATH }}"
BRANCH_NAME: "${{ github.event.client_payload.pull_request.head.ref && github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}"
BRANCH_NAME: "${{ github.event.client_payload.pull_request.head.ref || github.event.client_payload.pullRequestBranchName }}"
ADO_TOKEN: "${{ secrets.ADO_TOKEN }}"
ADO_BASE_URL: "${{ vars.ADO_BASE_URL }}"
ADO_AREAPATH: "${{ vars.ADO_AREAPATH }}"
Expand All @@ -18,13 +18,13 @@ on:
types: [package-command, Package-command, PACKAGE-command]
jobs:
solutionNameDetails:
if: ${{ github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork }}
if: ${{ !github.event.pull_request.head.repo.fork && !contains(github.event.client_payload.pull_request.head.ref , 'dependabot/') && !contains(github.event.client_payload.pullRequestBranchName , 'dependabot/') }}
uses: ./.github/workflows/getSolutionName.yaml
secrets: inherit

# BELOW JOB WILL CHECK IF WE NEED TO SKIP PACKAGE CREATION OR NOT
checkSkipPackagingDetails:
if: ${{ github.actor != 'dependabot[bot]' && needs.solutionNameDetails.outputs.solutionName != '' && !github.event.pull_request.head.repo.fork }}
if: ${{ needs.solutionNameDetails.outputs.solutionName != '' && !github.event.pull_request.head.repo.fork }}
uses: ./.github/workflows/checkSkipPackagingInfo.yaml
secrets: inherit
needs: solutionNameDetails
Expand All @@ -34,7 +34,7 @@ jobs:
neworexistingsolution:
needs: [solutionNameDetails, checkSkipPackagingDetails]
uses: ./.github/workflows/neworexistingsolution.yaml
if: ${{ github.actor != 'dependabot[bot]' && needs.solutionNameDetails.outputs.solutionName != '' && needs.checkSkipPackagingDetails.outputs.isPackagingRequired == 'True' }}
if: ${{ needs.solutionNameDetails.outputs.solutionName != '' && needs.checkSkipPackagingDetails.outputs.isPackagingRequired == 'True' }}
with:
solutionName: "${{ needs.solutionNameDetails.outputs.solutionName }}"
secrets: inherit
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/slash-command-armttk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# THIS WORKFLOW WILL RUN WHEN WE ADD SLASH COMMAND LIKE '/arm-ttk', '/ARM-TTK', '/Arm-Ttk', 'armttk' or 'ARMTTK'
name: Slash Command ARM-TTK Tests

on:
issue_comment:
types: [created, edited]

jobs:
run-arm-ttk:
runs-on: ubuntu-latest
if: ${{ github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork && github.event.issue.pull_request && contains(fromJson('["/armttk", "/Armttk", "/ARM-TTK", "/ARMTTK", "/arm-ttk", "/ArmTtk"]'), github.event.comment.body) }}
outputs:
solutionName: ${{ steps.step1.outputs.solutionName }}
mainTemplateChanged: ${{ steps.step1.outputs.mainTemplateChanged }}
createUiChanged: ${{ steps.step1.outputs.createUiChanged }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 5
ref: refs/pull/${{ github.event.issue.number }}/head
- shell: pwsh
id: step1
name: Identify Changes in PR
run: |
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module powershell-yaml
./.script/package-automation/arm-ttk-tests.ps1
- uses: docker/build-push-action@v2
id: publishGithubPackage
name: Run ARM-TTK
if: ${{ success() && steps.step1.outcome == 'success' && steps.step1.outputs.solutionName != '' && (steps.step1.outputs.mainTemplateChanged == 'true' || steps.step1.outputs.createUiChanged == 'true') }}
env:
SolutionName: ${{ steps.step1.outputs.solutionName }}
mainTemplateChanged: ${{ steps.step1.outputs.mainTemplateChanged }}
createUiChanged: ${{ steps.step1.outputs.createUiChanged }}
with:
context: .
file: ./.github/actions/Dockerfile
push: false
build-args: |
SolutionName
mainTemplateChanged
createUiChanged
57 changes: 57 additions & 0 deletions .script/package-automation/arm-ttk-tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

try {
$diff = git diff --diff-filter=d --name-only HEAD^ HEAD
Write-Host "List of files in PR: $diff"

$hasmainTemplateChanged = $false
$hasCreateUiDefinitionTemplateChanged = $false

$isChangeInSolutionsFolder = [bool]($diff | Where-Object {$_ -like 'Solutions/*'})
if (!$isChangeInSolutionsFolder)
{
Write-Host "Skipping as change is not in Solutions folder!"
exit 0
}

$requiredFiles = @("mainTemplate.json", "createUiDefinition.json")
$filteredFiles = $diff | Where-Object {$_ -match ($requiredFiles -Join "|")}
Write-Host "Filtered Files $filteredFiles"

$sName = ''
$hasmainTemplateChanged = $false
$hasCreateUiDefinitionTemplateChanged = $false

if ($filteredFiles.Count -gt 0)
{
$mainTemplateValue = $filteredFiles -match "mainTemplate.json"
$createUiValue = $filteredFiles -match "createUiDefinition.json"

if ($mainTemplateValue -or $createUiValue)
{
$hasmainTemplateChanged = $true
$hasCreateUiDefinitionTemplateChanged = $true
}

if ($filteredFiles.Count -eq 1)
{
$packageIndex = $filteredFiles.IndexOf("/Package")
$sName = $filteredFiles.SubString(10, $packageIndex - 10)
}
else
{
$packageIndex = $filteredFiles[0].IndexOf("/Package")
$sName = $filteredFiles[0].SubString(10, $packageIndex - 10)
}
}

Write-Host "solutionName $sName, mainTemplateChanged $hasmainTemplateChanged, createUiChanged $hasCreateUiDefinitionTemplateChanged"
Write-Output "solutionName=$sName" >> $env:GITHUB_OUTPUT
Write-Output "mainTemplateChanged=$hasmainTemplateChanged" >> $env:GITHUB_OUTPUT
Write-Output "createUiChanged=$hasCreateUiDefinitionTemplateChanged" >> $env:GITHUB_OUTPUT
}
catch {
Write-Host "Skipping as exception has occured Error Details: $_"
Write-Output "solutionName=''" >> $env:GITHUB_OUTPUT
Write-Output "mainTemplateChanged=$false" >> $env:GITHUB_OUTPUT
Write-Output "createUiChanged=$false" >> $env:GITHUB_OUTPUT
}
12 changes: 12 additions & 0 deletions .script/package-automation/getSolutionName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ try
$filteredFiles = $diff | Where-Object {$_ -match "Solutions/"} | Where-Object {$_ -notlike "Solutions/Images/*"} | Where-Object {$_ -notlike "Solutions/*.md"} | Where-Object { $_ -notlike '*system_generated_metadata.json' }
Write-Host "Filtered Files $filteredFiles"

# IDENTIFY EXCLUSIONS AND IF THERE ARE NO FILES AFTER EXCLUSION THEN SKIP WORKFLOW RUN
$exclusionList = @(".py$",".png$",".jpg$",".jpeg$",".conf$", ".svg$", ".html$", ".ps1$", ".psd1$", "requirements.txt$", "host.json$", "proxies.json$", "/function.json$", ".xml$", ".zip$", ".md$")

$filterOutExclusionList = $filteredFiles | Where-Object { $_ -notmatch ($exclusionList -join '|') }

if ($filterOutExclusionList.Count -le 0)
{
Write-Host "Skipping GitHub Action as changes in PR are not valid and contains only excluded files!"
Write-Output "solutionName=" >> $env:GITHUB_OUTPUT
exit 0
}

if ($filteredFiles.Count -gt 0)
{
if ($instrumentationKey -ne '')
Expand Down
53 changes: 53 additions & 0 deletions .script/tests/KqlvalidationsTests/CustomTables/MimecastDLP_CL.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"Name":"MimecastDLP_CL",
"Properties":[
{
"Name":"senderAddress_s",
"Type":"String"
},
{
"Name":"recipientAddress_s",
"Type":"String"
},
{
"Name":"subject_s",
"Type":"String"
},
{
"Name":"eventTime_d",
"Type":"DateTime"
},
{
"Name":"route_s",
"Type":"String"
},
{
"Name":"policy_s",
"Type":"String"
},
{
"Name":"action_s",
"Type":"String"
},
{
"Name":"messageId_s",
"Type":"String"
},
{
"Name":"mimecastEventId_s",
"Type":"String"
},
{
"Name":"mimecastEventCategory_s",
"Type":"String"
},
{
"Name":"time_generated",
"Type":"DateTime"
},
{
"Name":"TimeGenerated",
"Type":"DateTime"
}
]
}
Loading

0 comments on commit 23c9b0b

Please sign in to comment.