Skip to content

Commit 010826d

Browse files
update pipelines
1 parent 7996bf5 commit 010826d

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

Azure/Azure-Templatized-YML-Pipeline/flyway-11.14/templates/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ stages:
111111
- checkout: self
112112
name: source
113113

114-
- script: '$(FLYWAY) info check -dryrun -drift -changes -code -environments.target.url="$(target_database_JDBC)" -environments.check.url="$(check_JDBC)" -check.buildEnvironment="check" -check.rulesLocation="$(Build.SourcesDirectory)\templates\rules" -check.failOnDrift="${{parameters.failReleaseIfDriftDetected}}" -reportFilename="$(System.ArtifactsDirectory)\$(databaseName)-$(Build.BuildId)-$(DRIFT_AND_CHANGE_REPORT)"'
114+
- script: '$(FLYWAY) info check -dryrun -drift -changes -code -environments.target.url="$(target_database_JDBC)" -environments.check.url="$(check_JDBC)" -check.buildEnvironment="check" -environments.check.provisioner="clean" -check.rulesLocation="$(Build.SourcesDirectory)\templates\rules" -check.failOnDrift="${{parameters.failReleaseIfDriftDetected}}" -reportFilename="$(System.ArtifactsDirectory)\$(databaseName)-$(Build.BuildId)-$(DRIFT_AND_CHANGE_REPORT)"'
115115
continueOnError: false
116116
workingDirectory: '$(WORKING_DIRECTORY)\$(Build.Repository.Name)'
117117
displayName: '$(DRIFT_AND_CHANGE_REPORT_DISPLAY_NAME)'
@@ -140,7 +140,7 @@ stages:
140140
- checkout: self
141141
name: source
142142

143-
- script: '$(FLYWAY) info check -dryrun -drift -changes -environments.target.url="$(target_database_JDBC)" -environments.check.url="$(check_JDBC)" -check.buildEnvironment="check" -check.rulesLocation="$(Build.SourcesDirectory)\templates\rules" -check.failOnDrift="${{parameters.failReleaseIfDriftDetected}}" -reportFilename="$(System.ArtifactsDirectory)\$(databaseName)-$(Build.BuildId)-$(DRIFT_AND_CHANGE_REPORT)"'
143+
- script: '$(FLYWAY) info check -dryrun -drift -changes -environments.target.url="$(target_database_JDBC)" -environments.check.url="$(check_JDBC)" -check.buildEnvironment="check" -environments.check.provisioner="clean" -check.rulesLocation="$(Build.SourcesDirectory)\templates\rules" -check.failOnDrift="${{parameters.failReleaseIfDriftDetected}}" -reportFilename="$(System.ArtifactsDirectory)\$(databaseName)-$(Build.BuildId)-$(DRIFT_AND_CHANGE_REPORT)"'
144144
workingDirectory: '$(WORKING_DIRECTORY)'
145145
continueOnError: false
146146
displayName: '$(DRIFT_AND_CHANGE_REPORT_DISPLAY_NAME)'
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#TODO Hoist vars here
2+
3+
4+
# generic deployment
5+
flyway migrate -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model" -schemaModelSchemas= -environment=test
6+
7+
# create snapshot after changes
8+
flyway snapshot -environment=test -filename=snapshothistory:current -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model"
9+
10+
# undo back to a specific target number
11+
flyway undo -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model" -schemaModelSchemas= -environment=test -target=043.20250716213211
12+
13+
# cherryPick forward
14+
flyway migrate -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model" -schemaModelSchemas= -environment=test -cherryPick=045.20251106201536
15+
16+
# drift and code analysis report with snapshots
17+
18+
19+
# run drift and code analysis (TO SEE DRIFT ALTER TARGET DB OUTSIDE OF FLYWAY)
20+
# check can be configured to fail on drift or code analysis triggering
21+
# it's possible to capture changes as well, but it is a duplication of what's stored in schema model and requires an extra database to deploy to in a CI fashion
22+
flyway check -drift -code -dryrun -environment=test -check.code.failOnError=false -check.failOnDrift=false -check.deployedSnapshot=snapshothistory:current -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model"
23+
24+
# generic deployment
25+
flyway migrate -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model" -schemaModelSchemas= -environment=test
26+
27+
# create snapshot after changes
28+
flyway snapshot -environment=test -filename=snapshothistory:current -configFiles="C:\WorkingFolders\FWD\NewWorldDB\flyway.toml,C:\WorkingFolders\FWD\NewWorldDB\flyway.user.toml" -workingDirectory="C:\WorkingFolders\FWD\NewWorldDB" -schemaModelLocation="./schema-model"

Helpers/CheckProvisioner.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[environments.check]
2+
type = "sql"
3+
url = "jdbc:sqlserver://foo;databaseName=foo_check;encrypt=false;integratedSecurity=true"
4+
provisioner="clean"

0 commit comments

Comments
 (0)