-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from wesmacdonald/main
template to install Flyway client on windows, linux and macos
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
Azure-Templatized-YML-Pipeline/templates/installFlyway.yml
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,66 @@ | ||
parameters: | ||
- name: version | ||
type: string | ||
default: '9.21.1' | ||
- name: edition | ||
type: string | ||
default: community | ||
values: | ||
- community | ||
- teams | ||
- name: platform | ||
type: string | ||
default: windows | ||
values: | ||
- windows | ||
- macosx | ||
- linux | ||
|
||
|
||
steps: | ||
- task: PowerShell@2 | ||
displayName: 'Download and unzip Flyway command line' | ||
env: | ||
FLYWAY_LICENSE_KEY: $(FLYWAY_LICENSE_KEY) | ||
FLYWAY_VERSION: ${{ parameters.version }} | ||
FLYWAY_PLATFORM: ${{ parameters.platform }} | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
# Write your PowerShell commands here. | ||
$version = $env:FLYWAY_VERSION | ||
$platform = $env:FLYWAY_PLATFORM | ||
$extension = $platform -eq 'windows' ? 'zip' : 'tar.gz' | ||
Write-Host "Hello Flyway Enterprise, getting Version $version for $platform" | ||
$flywayZip = "https://download.red-gate.com/maven/release/org/flywaydb/enterprise/flyway-commandline/$version/flyway-commandline-$version-$platform-x64.$extension" | ||
$targetZip = "flyway-commandline-$version-$platform-x64.$extension" | ||
$flyway = "flyway-$version" | ||
$flywayPath = Join-Path (Get-Location).ToString() -ChildPath "\Tools\$flyway" | ||
mkdir ./Tools | ||
# Remove-Item .\Tools -Force -Recurse -ErrorAction Ignore | ||
Invoke-WebRequest $flywayZip -OutFile $targetZip | ||
if ($platform -eq 'windows') | ||
{ | ||
Expand-Archive -LiteralPath $targetZip -DestinationPath ./Tools | ||
} | ||
else | ||
{ | ||
tar -xvf $targetZip -C ./Tools | ||
chmod +x $flywayPath/flyway | ||
} | ||
write-host "##vso[task.prependpath]$flywayPath" | ||
pwsh: true | ||
workingDirectory: '$(Pipeline.Workspace)' | ||
- task: PowerShell@2 | ||
displayName: 'Check Flyway Client' | ||
continueOnError: true | ||
env: | ||
#FLYWAY_LICENSE_KEY: $(FLYWAY_LICENSE_KEY) | ||
FLYWAY_EDITION: ${{ parameters.edition }} | ||
inputs: | ||
targetType: 'inline' | ||
script: | | ||
write-host "$($env:PATH)" | ||
flyway -v | ||
pwsh: true | ||
failOnStderr: false |