Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ment-agent into crushton/DATAGO-78976_cmea_metrics
  • Loading branch information
CameronRushton committed Aug 16, 2024
2 parents 9a35ffe + 53e328c commit a860d2a
Show file tree
Hide file tree
Showing 13 changed files with 160 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ jobs:
path: "**/surefire-reports/**/*.xml"
reporter: java-junit
fail-on-error: true
only-summary: 'true'
only-summary: 'true'
112 changes: 112 additions & 0 deletions .github/workflows/deploy-managed-ema-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Deploy Managed EMA
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "The image tag in ECR to push to a new environment."
required: true
default: "A.B.C"
deployEnvironment:
description: "Environment to deploy to (development/staging/production)."
required: true
type: choice
options:
- development
- staging
- production
jobs:
deploy:
runs-on: ubuntu-latest
environment: prod

steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.EMA_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.EMA_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.EMA_AWS_DEFAULT_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/[email protected]
- name: ECR (Dev) - Pull Image
run: |
ECR_DEV_IMAGE="${{ steps.login-ecr.outputs.registry }}/${{ github.event.repository.name }}:main"
docker pull $ECR_DEV_IMAGE
echo "ECR_DEV_IMAGE=$ECR_DEV_IMAGE" >> $GITHUB_ENV
- name: GCR (Dev) - Login
if: ${{ github.event.inputs.deployEnvironment == 'development' }}
uses: docker/login-action@v3
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.DEV_GCP_SERVICE_ACCOUNT }}
- name: GCR (Dev) - Tag and Push
if: ${{ github.event.inputs.deployEnvironment == 'development' }}
run: |
GCR_IMAGE_TAGS_TO_PUSH=(
"${{ github.event.inputs.releaseVersion }}" "latest"
)
GCR_DEV_IMAGE_REPO="gcr.io/${{ secrets.DEV_GCP_PROJECT_ID }}/${{ github.event.repository.name }}"
for current_tag in ${GCR_IMAGE_TAGS_TO_PUSH[@]}
do
docker tag $ECR_DEV_IMAGE $GCR_DEV_IMAGE_REPO:$current_tag
docker push $GCR_DEV_IMAGE_REPO:$current_tag
done2
- name: GCR (Staging) - Login
if: ${{ github.event.inputs.deployEnvironment == 'staging' }}
uses: docker/login-action@v3
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.STAGING_GCP_SERVICE_ACCOUNT }}
- name: GCR (Staging) - Tag and Push
if: ${{ github.event.inputs.deployEnvironment == 'staging' }}
run: |
GCR_IMAGE_TAGS_TO_PUSH=(
"${{ github.event.inputs.releaseVersion }}" "latest"
)
GCR_STAGING_IMAGE_REPO="gcr.io/${{ secrets.STAGING_GCP_PROJECT_ID }}/${{ github.event.repository.name }}"
for current_tag in ${GCR_IMAGE_TAGS_TO_PUSH[@]}
do
docker tag $ECR_DEV_IMAGE $GCR_STAGING_IMAGE_REPO:$current_tag
docker push $GCR_STAGING_IMAGE_REPO:$current_tag
done
- name: GCR (Production) - Login
if: ${{ github.event.inputs.deployEnvironment == 'production' }}
uses: docker/login-action@v3
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.PROD_GCP_SERVICE_ACCOUNT }}
- name: GCR (Prod) - Tag and Push
if: ${{ github.event.inputs.deployEnvironment == 'production' }}
run: |
GCR_IMAGE_TAGS_TO_PUSH=(
"${{ github.event.inputs.releaseVersion }}" "latest"
)
GCR_PROD_IMAGE_REPO="gcr.io/${{ secrets.PROD_GCP_PROJECT_ID }}/${{ github.event.repository.name }}"
for current_tag in ${GCR_IMAGE_TAGS_TO_PUSH[@]}
do
docker tag $ECR_DEV_IMAGE $GCR_PROD_IMAGE_REPO:$current_tag
docker push $GCR_PROD_IMAGE_REPO:$current_tag
done
- name: Log in to Azure China prod docker registry
if: ${{ github.event.inputs.deployEnvironment == 'production' }}
uses: docker/login-action@v3
with:
registry: ${{ secrets.AZURE_CHINA_PROD_HOSTNAME }}
username: ${{ secrets.AZURE_CHINA_PROD_USERNAME }}
password: ${{ secrets.AZURE_CHINA_PROD_PASSWORD }}
- name: Azure China (Prod) - Tag and Push
if: ${{ github.event.inputs.deployEnvironment == 'production' }}
run: |
IMAGE_TAGS_TO_PUSH=(
"${{ github.event.inputs.releaseVersion }}" "latest"
)
PROD_IMAGE_REPO="${{ secrets.AZURE_CHINA_PROD_HOSTNAME }}/${{ github.event.repository.name }}"
for current_tag in ${IMAGE_TAGS_TO_PUSH[@]}
do
docker tag $ECR_DEV_IMAGE $PROD_IMAGE_REPO:$current_tag
docker push $PROD_IMAGE_REPO:$current_tag
done
8 changes: 4 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Default version to use when preparing a release."
description: "Default version to use when preparing a release (the current version with '-SNAPSHOT' removed)."
required: true
default: "X.Y.Z"
default: "A.B.C"
developmentVersion:
description: "Default version to use for new local working copy."
description: "Default version to use for new local working copy (the next version after version A.B.C)."
required: true
default: "X.Y.Z-SNAPSHOT"
jobs:
Expand Down Expand Up @@ -132,4 +132,4 @@ jobs:
export image_tag=${{ github.event.inputs.releaseVersion }}
export chart_version="n/a"
export sha=${{ github.sha }}
./.github/workflows/release_scripts/update_release_manifest.sh
./.github/workflows/release_scripts/update_release_manifest.sh
27 changes: 20 additions & 7 deletions service/application/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

# default user name is "emauser"
ARG USER=emauser
ENV HOME /home/$USER

VOLUME /tmp

RUN mkdir -p /opt/ema && chmod 777 /opt/ema && mkdir -p /opt/ema/terraform && chmod 777 /opt/ema/terraform
# create user and directory setup
RUN adduser -D $USER && \
mkdir -p /opt/ema && \
chmod 777 /opt/ema && \
mkdir -p /opt/ema/terraform && \
chmod 777 /opt/ema/terraform && \
chown -R $USER:$USER $HOME && \
chown -R $USER:$USER /opt/ema/

WORKDIR /opt/ema

ARG PLATFORM=linux_amd64

COPY tofu_1.7.0_amd64.apk /opt/ema/terraform
RUN apk --update add --allow-untrusted /opt/ema/terraform/tofu_1.7.0_amd64.apk

ARG SOLACE_PROVIDER_VERSION=0.9.2-rc.2
ADD terraform-provider-solacebroker_${SOLACE_PROVIDER_VERSION}_${PLATFORM}.tar.gz /opt/ema/terraform

COPY .terraformrc /root/.terraformrc

COPY .terraformrc $HOME/.terraformrc
RUN printf '#!/bin/ash\ntofu $*' > /opt/ema/terraform/terraform
RUN chmod +x /opt/ema/terraform/terraform

ENV PATH $PATH:/opt/ema/terraform

ARG SOLACE_PROVIDER_VERSION=0.9.2-rc.2
ADD terraform-provider-solacebroker_${SOLACE_PROVIDER_VERSION}_${PLATFORM}.tar.gz /opt/ema/terraform

ARG GITHASH
ARG GITBRANCH
ARG BUILD_TIMESTAMP
Expand All @@ -29,6 +39,9 @@ ENV GITHASH="${GITHASH}" \
GITBRANCH="${GITBRANCH}" \
BUILD_TIMESTAMP="${BUILD_TIMESTAMP}"

# switch to the created user from root
USER $USER

ARG JAR_FILE
ADD ${JAR_FILE} app.jar

Expand Down
16 changes: 8 additions & 8 deletions service/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<parent>
<groupId>com.solace.maas</groupId>
<artifactId>maas-event-management-agent-parent</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>event-management-agent</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Solace Event Management Agent - Application</name>
<description>Solace Event Management Agent - Application</description>
Expand Down Expand Up @@ -235,32 +235,32 @@
<dependency>
<groupId>com.solace.maas</groupId>
<artifactId>plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.solace.maas.plugin.kafka</groupId>
<artifactId>kafka-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.solace.maas.plugin.solace</groupId>
<artifactId>solace-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.solace.maas.plugin.localstorage</groupId>
<artifactId>local-storage-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.solace.maas.plugin.confluent-schema-registry</groupId>
<artifactId>confluent-schema-registry-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.solace.maas.plugin.terraform</groupId>
<artifactId>terraform-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down
4 changes: 2 additions & 2 deletions service/confluent-schema-registry-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.solace.maas.plugin.confluent-schema-registry</groupId>
<artifactId>confluent-schema-registry-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Solace Event Management Agent - Confluent Schema Registry Plugin</name>
<description>Solace Event Management Agent - Confluent Schema Registry Plugin</description>
Expand All @@ -22,7 +22,7 @@
<dependency>
<groupId>com.solace.maas</groupId>
<artifactId>plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
4 changes: 2 additions & 2 deletions service/kafka-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.solace.maas.plugin.kafka</groupId>
<artifactId>kafka-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Solace Event Management Agent - Kafka Plugin</name>
<description>Solace Event Management Agent - Kafka Plugin</description>
Expand Down Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>com.solace.maas</groupId>
<artifactId>plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
4 changes: 2 additions & 2 deletions service/local-storage-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.solace.maas.plugin.localstorage</groupId>
<artifactId>local-storage-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Solace Event Management Agent - Local Storage Plugin</name>
<description>Solace Event Management Agent - Local Storage Plugin</description>
Expand Down Expand Up @@ -115,7 +115,7 @@
<dependency>
<groupId>com.solace.maas</groupId>
<artifactId>plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
Expand Down
4 changes: 2 additions & 2 deletions service/plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<parent>
<groupId>com.solace.maas</groupId>
<artifactId>maas-event-management-agent-parent</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<groupId>com.solace.maas</groupId>
<artifactId>plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Solace Event Management Agent - Plugin</name>
<description>Solace Event Management Agent - Plugin</description>
Expand Down
2 changes: 1 addition & 1 deletion service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>com.solace.maas</groupId>
<artifactId>maas-event-management-agent-parent</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Solace Event Management Agent Maven Parent</name>
<description>Solace Solace Event Management Agent Maven Parent</description>
Expand Down
4 changes: 2 additions & 2 deletions service/rabbitmq-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.solace.maas.plugin.rabbitmq</groupId>
<artifactId>rabbitmq-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Solace Event Management Agent - RabbitMQ Plugin</name>
<description>Solace Event Management Agent - RabbitMQ Plugin</description>
Expand All @@ -27,7 +27,7 @@
<dependency>
<groupId>com.solace.maas</groupId>
<artifactId>plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
Expand Down
4 changes: 2 additions & 2 deletions service/solace-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.solace.maas.plugin.solace</groupId>
<artifactId>solace-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Solace Event Management Agent - Solace Plugin</name>
<description>Solace Event Management Agent - Solace Plugin</description>
Expand Down Expand Up @@ -96,7 +96,7 @@
<dependency>
<groupId>com.solace.maas</groupId>
<artifactId>plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
Expand Down
4 changes: 2 additions & 2 deletions service/terraform-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.solace.maas.plugin.terraform</groupId>
<artifactId>terraform-plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Solace Event Management Agent - Terraform Plugin</name>
<description>Solace Event Management Agent - Terraform Plugin</description>
Expand Down Expand Up @@ -65,7 +65,7 @@
<dependency>
<groupId>com.solace.maas</groupId>
<artifactId>plugin</artifactId>
<version>1.6.11-SNAPSHOT</version>
<version>1.6.12-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
Expand Down

0 comments on commit a860d2a

Please sign in to comment.