File tree Expand file tree Collapse file tree 2 files changed +42
-4
lines changed
Expand file tree Collapse file tree 2 files changed +42
-4
lines changed Original file line number Diff line number Diff line change 2222 solution : ' **/*.sln'
2323 buildPlatform : ' Any CPU'
2424 buildConfiguration : ' Release'
25+ dbPassword : ' '
26+ data-source.connection-string : ' '
27+ testDatabaseName : ' MySqlTestDb'
2528
2629 steps :
2730 - task : NuGetAuthenticate@1
@@ -48,10 +51,26 @@ jobs:
4851 dockerVersion : 17.09.0-ce
4952 releaseType : stable
5053
54+ - task : Bash@3
55+ displayName : ' Generate password'
56+ inputs :
57+ targetType : ' inline'
58+ script : |
59+ password=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | head -c24)
60+ echo "##vso[task.setvariable variable=dbPassword;]$password"
61+
62+ - task : PowerShell@2
63+ displayName : ' Set Connection String'
64+ inputs :
65+ targetType : ' inline'
66+ script : |
67+ $connectionString="server=localhost;database=$(testDatabaseName);uid=root;pwd=$(dbPassword)"
68+ Write-Host "##vso[task.setvariable variable=data-source.connection-string]$connectionString"
69+
5170 - bash : |
5271 docker run --name mysql-container -p 3306:3306 \
53- -e MYSQL_ROOT_PASSWORD=$(MySqlPassword ) \
54- -e MYSQL_DATABASE=$(TestDatabaseName ) \
72+ -e MYSQL_ROOT_PASSWORD=$(dbPassword ) \
73+ -e MYSQL_DATABASE=$(testDatabaseName ) \
5574 -d mysql
5675 condition: eq( variables['Agent.OS'], 'Linux' )
5776 displayName: Get and Start Ubuntu MySql Image Docker
Original file line number Diff line number Diff line change 1717 solution : ' **/*.sln'
1818 buildPlatform : ' Any CPU'
1919 buildConfiguration : ' Release'
20+ dbPassword : ' '
21+ data-source.connection-string : ' '
22+ testDatabaseName : ' PostgreSqlTestDb'
2023
2124 steps :
2225 - task : NuGetAuthenticate@1
@@ -43,10 +46,26 @@ jobs:
4346 dockerVersion : 17.09.0-ce
4447 releaseType : stable
4548
49+ - task : Bash@3
50+ displayName : ' Generate password'
51+ inputs :
52+ targetType : ' inline'
53+ script : |
54+ password=$(cat /dev/urandom | tr -dc 'A-Za-z0-9' | head -c24)
55+ echo "##vso[task.setvariable variable=dbPassword;]$password"
56+
57+ - task : PowerShell@2
58+ displayName : ' Set Connection String'
59+ inputs :
60+ targetType : ' inline'
61+ script : |
62+ $connectionString="Host=localhost;Database=$(testDatabaseName);username=postgres;password=$(dbPassword)"
63+ Write-Host "##vso[task.setvariable variable=data-source.connection-string]$connectionString"
64+
4665 - bash : |
4766 docker run --name postgres-container -p 5432:5432 \
48- -e POSTGRES_PASSWORD=$(PostgresPassword ) \
49- -e POSTGRES_DB=$(TestDatabaseName ) \
67+ -e POSTGRES_PASSWORD=$(dbPassword ) \
68+ -e POSTGRES_DB=$(testDatabaseName ) \
5069 -d postgres
5170 condition: eq( variables['Agent.OS'], 'Linux' )
5271 displayName: Get and Start Ubuntu Postgres Image Docker
You can’t perform that action at this time.
0 commit comments