-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/abzu 159849 pipeline simplification (#273)
* New build yaml * Fix indentation * Set container * Put container back * Pipeline rework * Fix typo * Set container * Further fix * Add parameters * Add jobs * More fixes * Update code coverage * More updates * Further fix * Fix * Fix * Revert rename * Remove dev retention * Retain test media * Remove unused variable * Remove more commented out code * Update NVD suppressions
- Loading branch information
1 parent
083a179
commit 130ae2f
Showing
16 changed files
with
583 additions
and
838 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,48 @@ | ||
|
||
Param( | ||
[Parameter(mandatory=$true)][string]$fssUIWebUrl, | ||
[Parameter(mandatory=$true)][string]$waitTimeInMinute | ||
param( | ||
[Parameter(mandatory=$true)][string]$FssUiWebUrl, | ||
[Parameter(mandatory=$true)][string]$WaitTimeInMinutes | ||
) | ||
|
||
$sleepTimeInSecond = 15 | ||
$isServiceActive = 'false' | ||
|
||
$stopWatch = New-Object -TypeName System.Diagnostics.Stopwatch | ||
$timeSpan = New-TimeSpan -Minutes $waitTimeInMinute | ||
$timeSpan = New-TimeSpan -Minutes $WaitTimeInMinutes | ||
$stopWatch.Start() | ||
|
||
do | ||
{ | ||
Write-Host "Polling url: $fssUIWebUrl ..." | ||
try{ | ||
$HttpRequest = [System.Net.WebRequest]::Create("$fssUIWebUrl") | ||
$HttpResponse = $HttpRequest.GetResponse() | ||
$HttpStatus = $HttpResponse.StatusCode | ||
Write-Host "Status code of web is $HttpStatus ..." | ||
do { | ||
Write-Host "Polling url: $FssUiWebUrl..." | ||
|
||
try { | ||
$httpRequest = [System.Net.WebRequest]::Create("$FssUiWebUrl") | ||
$httpResponse = $httpRequest.GetResponse() | ||
$httpStatus = $httpResponse.StatusCode | ||
Write-Host "Status code of web is $httpStatus..." | ||
|
||
If ($HttpStatus -eq 200 ) { | ||
if ($httpStatus -eq 200 ) { | ||
Write-Host "Website is up. Stopping Polling ..." | ||
$isServiceActive = 'true' | ||
break | ||
} | ||
Else { | ||
Write-Host "Website not yet Up. Status code: $HttpStatus re-checking after $sleepTimeInSecond sec ..." | ||
} else { | ||
Write-Host "Website not yet up. Status code: $httpStatus, re-checking after $sleepTimeInSecond sec..." | ||
} | ||
} | ||
catch [System.Net.WebException] | ||
{ | ||
$HttpStatus = $_.Exception.Response.StatusCode | ||
Write-Host "Website not yet Up.Status: $HttpStatus re-checking after $sleepTimeInSecond sec ..." | ||
$httpStatus = $_.Exception.Response.StatusCode | ||
Write-Host "Website not yet up. Status code: $httpStatus, re-checking after $sleepTimeInSecond sec..." | ||
} | ||
|
||
Start-Sleep -Seconds $sleepTimeInSecond | ||
} | ||
until ($stopWatch.Elapsed -ge $timeSpan) | ||
} until ($stopWatch.Elapsed -ge $timeSpan) | ||
|
||
|
||
If ($HttpResponse -ne $null) { | ||
$HttpResponse.Close() | ||
if ($httpResponse -ne $null) { | ||
$httpResponse.Close() | ||
} | ||
|
||
if ($isServiceActive -eq 'true' ) { | ||
Write-Host "Website is up returning from script ..." | ||
} | ||
Else { | ||
Write-Error "Website was not up in $waitTimeInMinute, error while deployment ..." | ||
Write-Host "Website is up, returning from script..." | ||
} else { | ||
Write-Error "Website was not up in $WaitTimeInMinutes, error in deployment." | ||
throw "Error" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
parameters: | ||
# Skip the NVD dependency check job. | ||
- name: SkipDependencyCheck | ||
type: boolean | ||
default: false | ||
# The Terraform Azure PowerShell container. | ||
- name: Container | ||
type: string | ||
|
||
jobs: | ||
- job: Dependencychecker | ||
condition: ne('${{ parameters.SkipDependencyCheck }}', true) | ||
pool: $(WindowPool) | ||
displayName: Dependency checker | ||
workspace: | ||
clean: all | ||
steps: | ||
- task: NodeTool@0 | ||
displayName: Install Node.js | ||
inputs: | ||
versionSpec: $(NodeVersion) | ||
|
||
- script: | | ||
npm ci | ||
displayName: npm restore | ||
- task: CmdLine@1 | ||
displayName: Run OWASP dependency-check | ||
inputs: | ||
filename: 'dependency-check.bat' | ||
arguments: '--project "UKHO.FileShareService.UI - $(Build.SourceBranchName)" --scan "$(Build.SourcesDirectory)" --out "$(Build.ArtifactStagingDirectory)\DCReport" --suppression $(Build.SourcesDirectory)\NVDSuppressions.xml --noupdate --disableYarnAudit' | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: Publish OWASP dependency-check report | ||
inputs: | ||
PathtoPublish: '$(Build.ArtifactStagingDirectory)\DCReport' | ||
ArtifactName: "OWASP Dependency Checker Report" | ||
|
||
- task: PowerShell@1 | ||
displayName: Fail build if OWASP dependency-check finds any vulnerabilities | ||
inputs: | ||
scriptType: inlineScript | ||
arguments: '-ReportLocation $(Build.ArtifactStagingDirectory)\DCReport\*' | ||
inlineScript: | | ||
param($ReportLocation) | ||
Invoke-VulnerabilityCheck -ReportLocation $ReportLocation | ||
- job: BuildTestPublish | ||
displayName: Build, test and publish | ||
pool: $(DeploymentPool) | ||
container: ${{ parameters.Container }} | ||
workspace: | ||
clean: all | ||
steps: | ||
- checkout: self | ||
|
||
- task: NodeTool@0 | ||
displayName: Install Node.js | ||
inputs: | ||
versionSpec: $(NodeVersion) | ||
|
||
- script: | | ||
npm ci | ||
displayName: npm restore | ||
- script: | | ||
npm run build | ||
displayName: npm build | ||
- script: | | ||
npm run test:unit | ||
continueOnError: false | ||
displayName: Unit test with Jest | ||
- task: PublishTestResults@2 | ||
condition: succeededOrFailed() | ||
displayName: Publish unit test results | ||
inputs: | ||
testRunner: 'JUnit' | ||
testResultsFiles: 'junit.xml' | ||
testRunTitle: Unit Test Results | ||
|
||
- task: PublishCodeCoverageResults@1 | ||
displayName: Publish code coverage results | ||
inputs: | ||
codeCoverageTool: 'Cobertura' | ||
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml' | ||
reportDirectory: 'coverage/' | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: Publish angular app artifacts | ||
inputs: | ||
PathtoPublish: '$(Build.SourcesDirectory)/dist' | ||
ArtifactName: AngularApp | ||
|
||
- task: PublishBuildArtifacts@1 | ||
displayName: Publish deployment artifact | ||
inputs: | ||
PathtoPublish: '$(Build.SourcesDirectory)/Deployment' | ||
ArtifactName: DeploymentScripts |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.