-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (115 loc) · 7.04 KB
/
Copy pathfwTaskPushCreateCheck.yml
File metadata and controls
135 lines (115 loc) · 7.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# This is a basic workflow to help you get started with Actions
name: Flyway Task Create Check Pipeline (Self-Hosted)
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for branches beginning with 'task' that have changes in the migrations folder.
push:
branches:
- 'task**'
paths:
- 'migrations/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
FLYWAY_LICENSE_KEY: ${{ secrets.FLYWAY_LICENSE_KEY }} #Repository Secret - Create this within the Projects Settings > Secrets > Actions section
# If the first undo script is U002, this will validate all undo scripts up to and including that
FIRST_UNDO_SCRIPT: ${{ secrets.FIRST_UNDO_SCRIPT }}
# Enable this for additional debug logging
ACTIONS_RUNNER_DEBUG: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
# build:
# name: Deploy Build
# # The type of runner that the job will run on
# runs-on: self-hosted
# environment: 'build' #Ensure this environment name is setup in the projects Settings>Environment area. Ensuring any reviewers are also configured
# env:
# stage: 'Build'
# # Environment Secrets - Ensure all of the below have been created as an Environment Secret (Projects Settings > Secrets > Actions section, specially related to the environment in question) #
# databaseName: ${{ secrets.databaseName}}
# JDBC: ${{ secrets.JDBC }}
# userName: ${{ secrets.userName }}
# password: ${{ secrets.password }}
# # End of Environment Secrets #
# displayName: 'Build'
# executeBuild: true
# publishArtifacts: true
# # Steps represent a sequence of tasks that will be executed as part of the job
# steps:
# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# - uses: actions/checkout@v3
# # Runs the Flyway Clean command against the Build database
# - name: Clean Build DB
# if: env.executeBuild == 'true'
# run: |
# flyway -user="${{ env.userName }}" -password="${{ env.password }}" -baselineOnMigrate="true" -licenseKey="${{ env.FLYWAY_LICENSE_KEY }}" -configFiles="${{ GITHUB.WORKSPACE }}\flyway.conf" -locations="filesystem:${{ GITHUB.WORKSPACE }}\migrations" info clean info -url="${{ env.JDBC }}" -cleanDisabled='false'
# # Runs the Flyway Migrate command against the Build database
# - name: Migrate Build DB
# if: env.executeBuild == 'true'
# run: |
# flyway -user="${{ env.userName }}" -password="${{ env.password }}" -baselineOnMigrate="true" -licenseKey="${{ env.FLYWAY_LICENSE_KEY }}" -configFiles="${{ GITHUB.WORKSPACE }}\flyway.conf" -locations="filesystem:${{ GITHUB.WORKSPACE }}\migrations" info migrate info -url="${{ env.JDBC }}" -cleanDisabled='false'
# # Runs the Flyway Undo command against the Build database
# - name: undo Build DB
# if: env.executeBuild == 'true'
# run: |
# flyway -user="${{ env.userName }}" -password="${{ env.password }}" -baselineOnMigrate="true" -licenseKey="${{ env.FLYWAY_LICENSE_KEY }}" -configFiles="${{ GITHUB.WORKSPACE }}\flyway.conf" -locations="filesystem:${{ GITHUB.WORKSPACE }}\migrations" info undo info -url="${{ env.JDBC }}" -cleanDisabled='false' -target="${{ env.FIRST_UNDO_SCRIPT }}"
# # Create a directory to stage the artifact files
# - name: Stage files for publishing
# if: env.publishArtifacts == 'true'
# run: |
# cp -R ${{ GITHUB.WORKSPACE }}/migrations Artifact_Files/Migration/
# #After migration scripts are validated, publish them as an artifact
# - name: Publish Validated Migration Scripts as Artifact
# if: env.publishArtifacts == 'true'
# uses: actions/upload-artifact@v3
# with:
# name: flyway-build-artifact
# path: Artifact_Files/Migration/
prod-preparation:
permissions: write-all
name: Production Deployment Preparation - Report Creation
# The type of runner that the job will run on
runs-on: self-hosted
environment: 'prod-check' #Ensure this environment name is setup in the projects Settings>Environment area. Ensuring any reviewers are also configured
if: ${{ true }} #Set this variable to false to temporarily disable the job
# needs: build
env:
stage: 'Prod'
branch_name: ${{ github.head_ref || github.ref_name }}
# Environment Secrets - Ensure all of the below have been created as an Environment Secret (Projects Settings > Secrets > Actions section, specially related to the environment in question) #
databaseName: ${{ secrets.databaseName}}
JDBC: ${{ secrets.JDBC }}
userName: ${{ secrets.userName }}
password: ${{ secrets.password }}
check_JDBC: ${{ secrets.check_JDBC }}
check_userName: ${{ secrets.check_userName }}
check_password: ${{ secrets.check_password }}
# End of Environment Secrets #
generateDriftAndChangeReport: true
failReleaseIfDriftDetected: false
staticCodeAnalysis: false #Currently not setup in this pipeline
publishArtifacts: true
GITHUB_TOKEN: ${{ github.token }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs the Flyway Check command, to produce a deployment report, against the Production database
# - name: Create Check Reports
# if: env.generateDriftAndChangeReport == 'true'
# run: |
# flyway -user="${{ env.userName }}" -password="${{ env.password }}" -baselineOnMigrate="true" -licenseKey="${{ env.FLYWAY_LICENSE_KEY }}" -configFiles="${{ GITHUB.WORKSPACE }}\flyway.conf" -locations="filesystem:${{ GITHUB.WORKSPACE }}\migrations" check -dryrun -changes -drift "-check.failOnDrift=${{ env.failReleaseIfDriftDetected }}" "-check.buildUrl=${{ env.check_JDBC }}" "-check.buildUser=${{ env.check_userName }}" "-check.buildPassword=${{ env.check_password }}" -url="${{ env.JDBC }}" "-check.reportFilename=${{ GITHUB.WORKSPACE }}\reports\${{ env.databaseName }}-Run-${{ GITHUB.RUN_ID }}-Check-Report.html"
# continue-on-error: true
# # Create a directory to stage the artifact files
# - name: Stage files for publishing
# if: env.publishArtifacts == 'true'
# run: |
# cp -R ${{ GITHUB.WORKSPACE }}\reports Artifact_Files/Reports/
# - name: Publish Check Report as Artifact
# uses: actions/upload-artifact@v3
# with:
# name: flyway-reports
# path: Artifact_Files/Reports/
- name: create pull request
run: gh pr create -B main -H "${{ env.branch_name }}" --title 'Merge ${{ env.branch_name }} into main' --body 'Created by Github action'