@@ -79,128 +79,128 @@ permissions:
79
79
id-token : write
80
80
81
81
jobs :
82
- oracle-rman-pre-duplicate :
83
- name : oracle-rman-pre-duplicate
84
- environment : ${{ github.event.inputs.TargetEnvironment }}-preapproved
85
- runs-on : ubuntu-latest
86
- container :
87
- image : ghcr.io/ministryofjustice/hmpps-delius-operational-automation:0.41.0
88
- timeout-minutes : 1440
89
- continue-on-error : false
90
- outputs :
91
- DuplicateTarget : ${{ steps.preparation.outputs.DuplicateTarget }}
92
- SourceOemEnvironment : ${{ steps.preparation.outputs.SourceOemEnvironment }}
93
- TargetOemEnvironment : ${{ steps.preparation.outputs.TargetOemEnvironment }}
94
- JobId : ${{ github.job }}
95
- steps :
96
-
97
- - name : Output Input Parameters
98
- shell : bash
99
- run : |
100
- echo -e "TargetEnvironment: ${{ github.event.inputs.TargetEnvironment }}\n\
101
- TargetHost: ${{ github.event.inputs.TargetHost }}\n\
102
- SourceLegacy: ${{ github.event.inputs.SourceLegacy }}\n\
103
- SourceDb: ${{ github.event.inputs.SourceDb }}\n\
104
- S3SourceBucket: ${{ github.event.inputs.S3SourceBucket }}\n\
105
- RestoreDatetime: ${{ github.event.inputs.RestoreDatetime }}\n\
106
- SourceCodeVersion: ${{ github.event.inputs.SourceCodeVersion }}\n\
107
- SourceConfigVersion: ${{ github.event.inputs.SourceConfigVersion }}"
108
-
109
- - name : Prepare Duplicate Target Name
110
- id : preparation
111
- shell : bash
112
- run : |
113
- echo "DuplicateTarget=environment_name_$(echo ${{ github.event.inputs.TargetEnvironment }} | sed 's/delius-core-dev/delius_core_development_dev/;s/delius-core-test/delius_core_test_test/;s/delius-core-training/delius_core_test_training/;s/delius-core-stage/delius_core_preproduction_stage/;s/delius-core-pre-prod/delius_core_preproduction_pre_prod/;s/delius-core-prod/delius_core_production_prod/')_${{ github.event.inputs.TargetHost }}" >> $GITHUB_OUTPUT
114
-
115
- - name : Check Restore DateTime Input
116
- if : ${{ github.event.inputs.RestoreDateTime != '' }}
117
- shell : bash
118
- run : |
119
- isDateInvalid()
120
- {
121
- DATE="${1}"
122
-
123
- # Time format hour[01..23]:min[01..59]:sec[01..59]
124
- TIMEFORMAT="(([012][0]|[01][1-9]|[2][1-3])-([012345][0-9])-([012345][0-9]))"
125
-
126
- # Date format day[01..31], month[01,03,05,07,08,10,12], year[1900..2099]
127
- DATE_1="((([123][0]|[012][1-9])|3[1])-(0[13578]|1[02])-(19|20)[0-9][0-9])"
128
-
129
- # Date format day[01..30], month[04,06,09,11], year[1900..2099]
130
- DATE_2="(([123][0]|[012][1-9])-(0[469]|11)-(19|20)[0-9][0-9])"
131
-
132
- # Date format day[01..28], month[02], year[1900..2099]
133
- DATE_3="(([12][0]|[01][1-9]|2[1-8])-02-(19|20)[0-9][0-9])"
134
-
135
- # Date format day[29], month[02], year[1904..2096]
136
- DATE_4="(29-02-(19|20(0[48]|[2468][048]|[13579][26])))"
137
-
138
- # Match the date in the Regex
139
- if [[ "${DATE}" =~ ^((${DATE_1}|${DATE_2}|${DATE_3}|${DATE_4})-${TIMEFORMAT})$ ]]
140
- then
141
- echo "Restore Datetime ${DATE} valid"
142
- else
143
- echo "Restore Datetime ${DATE} invalid!"
144
- fi
145
- }
146
- isDateInvalid '${{ github.event.inputs.RestoreDateTime }}'
147
-
148
- - name : Checkout hmpps-delius-operation-automation
149
- uses : actions/checkout@v4
150
- with :
151
- sparse-checkout-cone-mode : false
152
- sparse-checkout : |
153
- playbooks/oracle_duplicate
154
- playbooks/delius_users
155
- playbooks/awr_export
156
- playbooks/block_sessions
157
- playbooks/oem_blackout
158
- common/*
159
- playbooks/ansible.cfg
160
- path : operations
161
- ref : ${{ github.event.inputs.SourceCodeVersion }}
162
- fetch-depth : 0
163
-
164
- - name : Checkout modernisation-platform-configuration-management
165
- uses : actions/checkout@v4
166
- with :
167
- repository : ministryofjustice/modernisation-platform-configuration-management
168
- sparse-checkout-cone-mode : false
169
- sparse-checkout : |
170
- ansible/hosts
171
- ansible/group_vars
172
- path : inventory
173
- ref : ${{ github.event.inputs.SourceConfigVersion }}
174
- fetch-depth : 0
175
-
176
- - name : Checkout Ansible Required Roles From modernisation-platform-configuration-management
177
- uses : actions/checkout@v4
178
- with :
179
- repository : ministryofjustice/modernisation-platform-configuration-management
180
- sparse-checkout-cone-mode : false
181
- sparse-checkout : |
182
- ansible/roles/secretsmanager-passwords
183
- ansible/roles/get-modernisation-platform-facts
184
- path : roles
185
- ref : ${{ github.event.inputs.SourceConfigVersion }}
186
- fetch-depth : 0
187
-
188
- - name : Configure AWS Credentials
189
- id : login-aws
190
- uses : aws-actions/configure-aws-credentials@v4
191
- with :
192
- role-to-assume : " arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/modernisation-platform-oidc-cicd"
193
- role-session-name : " hmpps-delius-operational-automation-${{ github.run_number }}"
194
- aws-region : " eu-west-2"
195
-
196
- - name : Start Ansible Oracle RMAN Pre Duplicate
197
- shell : bash
198
- run : |
199
- export ANSIBLE_CONFIG=$ansible_config
200
- ln -s $PWD/roles/ansible/roles $PWD/operations/playbooks/oracle_duplicate/roles
201
- $ansible_playbook_directory/rman-pre-duplicate.yml -e ansible_aws_ssm_bucket_name=${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }} -i $inventory \
202
- -e duplicate_target=${{ steps.preparation.outputs.DuplicateTarget }} \
203
- -e skip_audited_interaction_archival=${{ github.event.inputs.SkipAudit }}
82
+ # oracle-rman-pre-duplicate:
83
+ # name: oracle-rman-pre-duplicate
84
+ # environment: ${{ github.event.inputs.TargetEnvironment }}-preapproved
85
+ # runs-on: ubuntu-latest
86
+ # container:
87
+ # image: ghcr.io/ministryofjustice/hmpps-delius-operational-automation:0.41.0
88
+ # timeout-minutes: 1440
89
+ # continue-on-error: false
90
+ # outputs:
91
+ # DuplicateTarget: ${{ steps.preparation.outputs.DuplicateTarget }}
92
+ # SourceOemEnvironment: ${{ steps.preparation.outputs.SourceOemEnvironment }}
93
+ # TargetOemEnvironment: ${{ steps.preparation.outputs.TargetOemEnvironment }}
94
+ # JobId: ${{ github.job }}
95
+ # steps:
96
+
97
+ # - name: Output Input Parameters
98
+ # shell: bash
99
+ # run: |
100
+ # echo -e "TargetEnvironment: ${{ github.event.inputs.TargetEnvironment }}\n\
101
+ # TargetHost: ${{ github.event.inputs.TargetHost }}\n\
102
+ # SourceLegacy: ${{ github.event.inputs.SourceLegacy }}\n\
103
+ # SourceDb: ${{ github.event.inputs.SourceDb }}\n\
104
+ # S3SourceBucket: ${{ github.event.inputs.S3SourceBucket }}\n\
105
+ # RestoreDatetime: ${{ github.event.inputs.RestoreDatetime }}\n\
106
+ # SourceCodeVersion: ${{ github.event.inputs.SourceCodeVersion }}\n\
107
+ # SourceConfigVersion: ${{ github.event.inputs.SourceConfigVersion }}"
108
+
109
+ # - name: Prepare Duplicate Target Name
110
+ # id: preparation
111
+ # shell: bash
112
+ # run: |
113
+ # echo "DuplicateTarget=environment_name_$(echo ${{ github.event.inputs.TargetEnvironment }} | sed 's/delius-core-dev/delius_core_development_dev/;s/delius-core-test/delius_core_test_test/;s/delius-core-training/delius_core_test_training/;s/delius-core-stage/delius_core_preproduction_stage/;s/delius-core-pre-prod/delius_core_preproduction_pre_prod/;s/delius-core-prod/delius_core_production_prod/')_${{ github.event.inputs.TargetHost }}" >> $GITHUB_OUTPUT
114
+
115
+ # - name: Check Restore DateTime Input
116
+ # if: ${{ github.event.inputs.RestoreDateTime != '' }}
117
+ # shell: bash
118
+ # run: |
119
+ # isDateInvalid()
120
+ # {
121
+ # DATE="${1}"
122
+
123
+ # # Time format hour[01..23]:min[01..59]:sec[01..59]
124
+ # TIMEFORMAT="(([012][0]|[01][1-9]|[2][1-3])-([012345][0-9])-([012345][0-9]))"
125
+
126
+ # # Date format day[01..31], month[01,03,05,07,08,10,12], year[1900..2099]
127
+ # DATE_1="((([123][0]|[012][1-9])|3[1])-(0[13578]|1[02])-(19|20)[0-9][0-9])"
128
+
129
+ # # Date format day[01..30], month[04,06,09,11], year[1900..2099]
130
+ # DATE_2="(([123][0]|[012][1-9])-(0[469]|11)-(19|20)[0-9][0-9])"
131
+
132
+ # # Date format day[01..28], month[02], year[1900..2099]
133
+ # DATE_3="(([12][0]|[01][1-9]|2[1-8])-02-(19|20)[0-9][0-9])"
134
+
135
+ # # Date format day[29], month[02], year[1904..2096]
136
+ # DATE_4="(29-02-(19|20(0[48]|[2468][048]|[13579][26])))"
137
+
138
+ # # Match the date in the Regex
139
+ # if [[ "${DATE}" =~ ^((${DATE_1}|${DATE_2}|${DATE_3}|${DATE_4})-${TIMEFORMAT})$ ]]
140
+ # then
141
+ # echo "Restore Datetime ${DATE} valid"
142
+ # else
143
+ # echo "Restore Datetime ${DATE} invalid!"
144
+ # fi
145
+ # }
146
+ # isDateInvalid '${{ github.event.inputs.RestoreDateTime }}'
147
+
148
+ # - name: Checkout hmpps-delius-operation-automation
149
+ # uses: actions/checkout@v4
150
+ # with:
151
+ # sparse-checkout-cone-mode: false
152
+ # sparse-checkout: |
153
+ # playbooks/oracle_duplicate
154
+ # playbooks/delius_users
155
+ # playbooks/awr_export
156
+ # playbooks/block_sessions
157
+ # playbooks/oem_blackout
158
+ # common/*
159
+ # playbooks/ansible.cfg
160
+ # path: operations
161
+ # ref: ${{ github.event.inputs.SourceCodeVersion }}
162
+ # fetch-depth: 0
163
+
164
+ # - name: Checkout modernisation-platform-configuration-management
165
+ # uses: actions/checkout@v4
166
+ # with:
167
+ # repository: ministryofjustice/modernisation-platform-configuration-management
168
+ # sparse-checkout-cone-mode: false
169
+ # sparse-checkout: |
170
+ # ansible/hosts
171
+ # ansible/group_vars
172
+ # path: inventory
173
+ # ref: ${{ github.event.inputs.SourceConfigVersion }}
174
+ # fetch-depth: 0
175
+
176
+ # - name: Checkout Ansible Required Roles From modernisation-platform-configuration-management
177
+ # uses: actions/checkout@v4
178
+ # with:
179
+ # repository: ministryofjustice/modernisation-platform-configuration-management
180
+ # sparse-checkout-cone-mode: false
181
+ # sparse-checkout: |
182
+ # ansible/roles/secretsmanager-passwords
183
+ # ansible/roles/get-modernisation-platform-facts
184
+ # path: roles
185
+ # ref: ${{ github.event.inputs.SourceConfigVersion }}
186
+ # fetch-depth: 0
187
+
188
+ # - name: Configure AWS Credentials
189
+ # id: login-aws
190
+ # uses: aws-actions/configure-aws-credentials@v4
191
+ # with:
192
+ # role-to-assume: "arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/modernisation-platform-oidc-cicd"
193
+ # role-session-name: "hmpps-delius-operational-automation-${{ github.run_number }}"
194
+ # aws-region: "eu-west-2"
195
+
196
+ # - name: Start Ansible Oracle RMAN Pre Duplicate
197
+ # shell: bash
198
+ # run: |
199
+ # export ANSIBLE_CONFIG=$ansible_config
200
+ # ln -s $PWD/roles/ansible/roles $PWD/operations/playbooks/oracle_duplicate/roles
201
+ # $ansible_playbook_directory/rman-pre-duplicate.yml -e ansible_aws_ssm_bucket_name=${{ vars.ANSIBLE_AWS_SSM_BUCKET_NAME }} -i $inventory \
202
+ # -e duplicate_target=${{ steps.preparation.outputs.DuplicateTarget }} \
203
+ # -e skip_audited_interaction_archival=${{ github.event.inputs.SkipAudit }}
204
204
205
205
oracle-rman-export-schema :
206
206
if : ${{ github.event.inputs.SourceLegacy == 'no' }}
@@ -355,7 +355,7 @@ jobs:
355
355
-e source_db_backup_s3_bucket_name=${{ needs.oracle-rman-export-schema.outputs.SourceDbBackupS3BucketName }}
356
356
357
357
oracle-rman-duplicate :
358
- if : ${{ always() && ((github.event.inputs.SourceLegacy == 'no' && needs.oracle-rman-import-schema.result == ' success') || (github.event.inputs.SourceLegacy == 'yes' && needs.oracle-rman-import-schema.result == 'skipped') ) }}
358
+ if : ${{ success( ) }}
359
359
name : oracle-rman-duplicate
360
360
environment : ${{ github.event.inputs.TargetEnvironment }}-preapproved
361
361
runs-on : ubuntu-latest
0 commit comments