Skip to content

Commit

Permalink
Merge pull request #574 from bcgov/develop
Browse files Browse the repository at this point in the history
Promote
  • Loading branch information
leewrigh authored May 28, 2024
2 parents 37ec54d + f7d1e06 commit 9579554
Show file tree
Hide file tree
Showing 235 changed files with 1,206 additions and 8,527 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build-push-edtcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ jobs:
echo "Updating ${{ env.BRANCH_NAME }} helm values to trigger ArgoCD deployment "
# Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test
cd gitops/charts
# Update the Helm values file with the new image tag and version
Expand All @@ -105,9 +106,10 @@ jobs:
git add .

git add ../deploy/${{ env.VALUES_FILE }}_values.yaml

# Repackage Helm Chart
cd edt-service

# Repackage Helm Chart
cd edt-service


helm dependency build

Expand All @@ -116,3 +118,4 @@ jobs:
git commit -m "Update ${{ env.BRANCH_NAME }} API image tag"
git push origin ${{ env.BRANCH_NAME }} # Update the branch name as needed


2 changes: 1 addition & 1 deletion .github/workflows/build-push-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful
run: |
echo "Updating ${{ env.BRANCH_NAME }} helm values to trigger ArgoCD deployment"
echo "Updating helm ${{ env.BRANCH_NAME }} values to trigger ArgoCD deployment"
# Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test
cd gitops/charts
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/build-push-kafka-connectors.yml
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##*/}
1 change: 0 additions & 1 deletion backend/ApprovalFlow/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public void ConfigureServices(IServiceCollection services)

}


services
.AddAutoMapper(typeof(Startup))
.AddKafkaConsumer(config)
Expand Down
6 changes: 3 additions & 3 deletions backend/DIAMConfiguration/DIAMConfiguration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter" Version="8.0.2" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.2">
<PackageReference Include="Microsoft.AspNetCore.Components.QuickGrid.EntityFrameworkAdapter" Version="8.0.5" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
10 changes: 10 additions & 0 deletions backend/MessagingAdapter/AWS/Producer/ISNSProducer.cs
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();
}
83 changes: 83 additions & 0 deletions backend/MessagingAdapter/AWS/Producer/SNSProducer.cs
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();

}
}
12 changes: 12 additions & 0 deletions backend/MessagingAdapter/AWS/Subscriber/ISQSSubscriber.cs
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);

}
Loading

0 comments on commit 9579554

Please sign in to comment.