-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #574 from bcgov/develop
Promote
- Loading branch information
Showing
235 changed files
with
1,206 additions
and
8,527 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
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,85 @@ | ||
name: diam-kafka-connectors | ||
|
||
on: | ||
push: | ||
branches: [develop,test] | ||
paths: | ||
- "integration/kafka-connect/**" | ||
- ".github/workflows/build-push-kafka-connectors.yml" | ||
workflow_dispatch: | ||
env: | ||
IMAGE_NAME: diam-kafka-connectors | ||
WORKING_DIRECTORY: ./integration/kafka-connect | ||
BRANCH_NAME: develop | ||
VALUES_FILE: dev | ||
|
||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set environment for branch | ||
run: | | ||
if [[ ${{ github.ref_name }} == 'main' ]]; then | ||
echo "BRANCH_NAME=main" >> "$GITHUB_ENV" | ||
echo "VALUES_FILE=prod" >> "$GITHUB_ENV" | ||
fi | ||
if [[ ${{ github.ref_name }} == 'test' ]]; then | ||
echo "BRANCH_NAME=test" >> "$GITHUB_ENV" | ||
echo "VALUES_FILE=test" >> "$GITHUB_ENV" | ||
fi | ||
if [[ ${{ github.ref_name }} == 'develop' ]]; then | ||
echo "BRANCH_NAME=develop" >> "$GITHUB_ENV" | ||
echo "VALUES_FILE=dev" >> "$GITHUB_ENV" | ||
fi | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | ||
id: extract_branch | ||
|
||
- name: Branch name | ||
run: echo running on branch ${GITHUB_REF##*/} | ||
|
||
- name: Branch name | ||
run: echo running on branch ${GITHUB_REF##*/} | ||
|
||
|
||
# Get SHORT_SHA to tag images | ||
- name: Get short SHA | ||
id: short_sha | ||
run: | | ||
echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" | ||
echo "Short SHA: $SHORT_SHA" | ||
- name: Login to RHEC | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.REDHAT_USER }} | ||
password: ${{ secrets.RH_TOKEN }} | ||
registry: registry.redhat.io | ||
|
||
- name: Build Image | ||
|
||
working-directory: ${{env.WORKING_DIRECTORY}} | ||
run: | | ||
docker build -t artifacts.developer.gov.bc.ca/de27-general-docker/${{env.IMAGE_NAME}}:${GITHUB_REF##*/} . | ||
- name: Login to Artifactory | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: artifacts.developer.gov.bc.ca | ||
username: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
password: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||
|
||
- name: Docker Push to Artifactory | ||
id: publish | ||
run: | | ||
docker push artifacts.developer.gov.bc.ca/de27-general-docker/${{env.IMAGE_NAME}}:${GITHUB_REF##*/} |
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,10 @@ | ||
namespace MessagingAdapter.AWS.Producer; | ||
|
||
using Amazon.SimpleNotificationService.Model; | ||
using MessagingAdapter.Models; | ||
|
||
public interface ISNSProducer | ||
{ | ||
Task<PublishResponse> ProduceAsync(EventModel eventModel); | ||
Task<IEnumerable<string>> ListAllTopicsAsync(); | ||
} |
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,83 @@ | ||
namespace MessagingAdapter.AWS.Producer; | ||
|
||
using System.Collections.Generic; | ||
using Amazon; | ||
using Amazon.Runtime.CredentialManagement; | ||
using Amazon.SimpleNotificationService; | ||
using Amazon.SimpleNotificationService.Model; | ||
using MessagingAdapter.Configuration; | ||
using MessagingAdapter.Models; | ||
|
||
public class SNSProducer : ISNSProducer | ||
{ | ||
private ILogger<SNSProducer> logger; | ||
private AmazonSimpleNotificationServiceClient client; | ||
private readonly IConfiguration configuration; | ||
|
||
public SNSProducer() | ||
{ | ||
} | ||
|
||
|
||
|
||
public SNSProducer(ILogger<SNSProducer> logger, IConfiguration configuration) | ||
{ | ||
this.logger = logger; | ||
this.configuration = configuration; | ||
var options = this.configuration.GetAWSOptions(); | ||
var credentialProfileStoreChain = new CredentialProfileStoreChain(); | ||
if (credentialProfileStoreChain.TryGetAWSCredentials(options.Profile, out var credentials)) | ||
{ | ||
options.Credentials = credentials; | ||
} | ||
|
||
this.client = new AmazonSimpleNotificationServiceClient(options.Credentials, RegionEndpoint.CACentral1); | ||
|
||
|
||
} | ||
|
||
public async Task<PublishResponse> ProduceAsync(EventModel eventModel) | ||
{ | ||
var attributes = new Dictionary<string, MessageAttributeValue>(); | ||
|
||
var filterType = (eventModel is DisclosureEventModel model) ? model.DisclosureEventType.ToString() : "unknown"; | ||
var value = new MessageAttributeValue | ||
{ | ||
DataType = "String", | ||
StringValue = filterType | ||
}; | ||
|
||
attributes.Add("EventType", value); | ||
|
||
var publisherOptions = new PublisherOptions(); | ||
this.configuration.GetSection(PublisherOptions.Publisher).Bind(publisherOptions); | ||
|
||
var publishRequest = new PublishRequest | ||
{ | ||
Message = eventModel.AsJSON(), | ||
MessageAttributes = attributes, | ||
Subject = "Disclosure Test", | ||
TopicArn = publisherOptions.SNSTarget | ||
}; | ||
return await this.client.PublishAsync(publishRequest); | ||
} | ||
|
||
|
||
|
||
|
||
/// <summary> | ||
/// Get all topic names | ||
/// </summary> | ||
/// <returns></returns> | ||
public async Task<IEnumerable<string>> ListAllTopicsAsync() | ||
{ | ||
var topics = await this.client.ListTopicsAsync(); | ||
topics.Topics.ForEach(topic => | ||
{ | ||
this.logger.LogInformation($"Topic {topic.TopicArn}"); | ||
}); | ||
|
||
return topics.Topics.Select(t => t.TopicArn.ToString()).ToList(); | ||
|
||
} | ||
} |
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 MessagingAdapter.AWS.Subscriber; | ||
|
||
using System.Threading.Tasks; | ||
using MessagingAdapter.Models; | ||
|
||
public interface ISQSSubscriber | ||
{ | ||
Task<List<DisclosureEventModel>> GetMessages(); | ||
Task<IEnumerable<string>> ListQueuesAsync(); | ||
Task<bool> AcknowledgeMessagesAsync(string qUrl, Dictionary<string, string> receiptHandles); | ||
|
||
} |
Oops, something went wrong.