-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
58 changed files
with
2,369 additions
and
61 deletions.
There are no files selected for viewing
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,40 @@ | ||
name: Deploy DB Migration - Dev | ||
|
||
on: | ||
push: | ||
branches: [develop] | ||
workflow_dispatch: | ||
|
||
# This will terminate builds that are previously, but continuing to run. Saves GHA hours. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
helm-deployment: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Authenticate and set context | ||
uses: redhat-actions/[email protected] | ||
with: | ||
openshift_server_url: ${{secrets.OPENSHIFT_CLUSTER_URL}} | ||
openshift_token: ${{secrets.OPENSHIFT_PIPELINE_SERVICE_ACCOUNT_TOKEN}} | ||
|
||
- name: deply db migration job | ||
run: | | ||
oc project d8a8f9-dev | ||
echo deleting dev-webapi-migrations job | ||
oc delete job/dev-webapi-migrations --ignore-not-found | ||
echo applying web-api-migration template... | ||
helm template dev charts/webapi -n d8a8f9-dev --values ./deploy/dev_values.yaml -s templates/migrations.yaml --wait --debug| oc apply -n d8a8f9-dev -f - | ||
echo deleting dev-plr-intake-migrations job | ||
oc delete job/dev-plr-intake-migrations --ignore-not-found | ||
echo applying plr-intake-migration template... | ||
helm template dev charts/plr-intake -n d8a8f9-dev --values ./deploy/dev_values.yaml -s templates/migrations.yaml --wait --debug| oc apply -n d8a8f9-dev -f - |
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,40 @@ | ||
name: Deploy DB Migration - Prod | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
# This will terminate builds that are previously, but continuing to run. Saves GHA hours. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
helm-deployment: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Authenticate and set context | ||
uses: redhat-actions/[email protected] | ||
with: | ||
openshift_server_url: ${{secrets.OPENSHIFT_CLUSTER_URL}} | ||
openshift_token: ${{secrets.OPENSHIFT_PIPELINE_SERVICE_ACCOUNT_TOKEN}} | ||
|
||
- name: deply db migration job | ||
run: | | ||
oc project d8a8f9-prod | ||
echo deleting prod-webapi-migrations job | ||
oc delete job/prod-webapi-migrations -n d8a8f9-prod --ignore-not-found | ||
echo applying web-api-migration template... | ||
helm template prod charts/webapi -n d8a8f9-prod --values ./deploy/prod_values.yaml -s templates/migrations.yaml --wait --debug| oc apply -n d8a8f9-prod -f - | ||
echo deleting prod-plr-intake-migrations job | ||
oc delete job/prod-plr-intake-migrations -n d8a8f9-prod --ignore-not-found | ||
echo applying plr-intake-migration template... | ||
helm template prod charts/plr-intake -n d8a8f9-prod --values ./deploy/prod_values.yaml -s templates/migrations.yaml --wait --debug| oc apply -n d8a8f9-prod -f - |
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,40 @@ | ||
name: Deploy DB Migration - Test | ||
|
||
on: | ||
push: | ||
branches: [test] | ||
workflow_dispatch: | ||
|
||
# This will terminate builds that are previously, but continuing to run. Saves GHA hours. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
helm-deployment: | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Authenticate and set context | ||
uses: redhat-actions/[email protected] | ||
with: | ||
openshift_server_url: ${{secrets.OPENSHIFT_CLUSTER_URL}} | ||
openshift_token: ${{secrets.OPENSHIFT_PIPELINE_SERVICE_ACCOUNT_TOKEN}} | ||
|
||
- name: deply db migration job into d8a8f9-test | ||
run: | | ||
oc project d8a8f9-test | ||
echo deleting test-webapi-migrations job | ||
oc delete job/test-webapi-migrations --ignore-not-found | ||
echo applying web-api-migration template... | ||
helm template test charts/webapi -n d8a8f9-test --values ./deploy/test_values.yaml -s templates/migrations.yaml --wait --debug| oc apply -f - | ||
echo deleting test-plr-intake-migrations job | ||
oc delete job/test-plr-intake-migrations --ignore-not-found | ||
echo applying plr-intake-migration template... | ||
helm template test charts/plr-intake -n d8a8f9-test --values ./deploy/test_values.yaml -s templates/migrations.yaml --wait --debug| oc apply -f - |
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
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
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
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,19 @@ | ||
{ | ||
"dotnet.defaultSolution": "../pidp-backend.sln", | ||
"editor.bracketPairColorization.enabled": true, | ||
"editor.formatOnPaste": true, | ||
"editor.formatOnType": true, | ||
"editor.guides.bracketPairs": "active", | ||
"editor.minimap.enabled": true, | ||
"editor.renderWhitespace": "boundary", | ||
"editor.tabSize": 4, | ||
"files.autoSave": "onFocusChange", | ||
"files.trimTrailingWhitespace": true, | ||
"git.ignoreLimitWarning": true, | ||
"omnisharp.enableEditorConfigSupport": true, | ||
"search.exclude": { | ||
"**/bin": true, | ||
"**/logs": true, | ||
"**/obj": true, | ||
}, | ||
} |
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,57 @@ | ||
namespace UpdateOpId; | ||
|
||
using Microsoft.Extensions.Hosting; | ||
using Microsoft.Extensions.Logging; | ||
|
||
internal sealed class HostedServiceWrapper : IHostedService | ||
{ | ||
private readonly IUpdateOpIdService service; | ||
private readonly IHostApplicationLifetime appLifetime; | ||
private readonly ILogger logger; | ||
private int? exitCode; | ||
|
||
public HostedServiceWrapper( | ||
IUpdateOpIdService service, | ||
IHostApplicationLifetime appLifetime, | ||
ILogger<HostedServiceWrapper> logger) | ||
{ | ||
this.service = service; | ||
this.appLifetime = appLifetime; | ||
this.logger = logger; | ||
} | ||
|
||
public Task StartAsync(CancellationToken cancellationToken) | ||
{ | ||
this.appLifetime.ApplicationStarted.Register(async () => | ||
{ | ||
try | ||
{ | ||
await this.service.UpdateOpIdAsync(); | ||
this.exitCode = 0; | ||
} | ||
catch (Exception ex) | ||
{ | ||
this.logger.LogUnhandledException(ex); | ||
this.exitCode = 1; | ||
} | ||
finally | ||
{ | ||
this.appLifetime.StopApplication(); | ||
} | ||
}); | ||
|
||
return Task.CompletedTask; | ||
} | ||
|
||
public Task StopAsync(CancellationToken cancellationToken) | ||
{ | ||
Environment.ExitCode = this.exitCode.GetValueOrDefault(-1); | ||
return Task.CompletedTask; | ||
} | ||
} | ||
|
||
public static partial class HostedServiceWrapperLoggingExtensions | ||
{ | ||
[LoggerMessage(1, LogLevel.Error, "Unhandled exception in HostedServiceWrapper.")] | ||
public static partial void LogUnhandledException(this ILogger logger, Exception e); | ||
} |
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,12 @@ | ||
namespace UpdateOpId; | ||
|
||
public interface IUpdateOpIdService | ||
{ | ||
/// <summary> | ||
/// Generates an identifier for each Party in the database | ||
/// with a BCSC account that does not have an OpId | ||
/// and updates the party in the database. | ||
/// </summary> | ||
/// <returns></returns> | ||
public Task UpdateOpIdAsync(); | ||
} |
Oops, something went wrong.