Skip to content

Commit

Permalink
Merge e226665 into 49a7fbf
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpearce-digital authored Jan 28, 2025
2 parents 49a7fbf + e226665 commit 5bd0fe7
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 53 deletions.
71 changes: 39 additions & 32 deletions .github/workflows/workflow_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,36 +92,36 @@ jobs:
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
pagerduty_api_key: ${{ secrets.PAGERDUTY_API_KEY }}

ui_tests_image:
name: Run Cypress UI Tests On Images
if: needs.detect_changes.outputs.changes_detected == 'true' &&
(needs.docker_build_scan_push.result == 'success' || needs.docker_build_scan_push.result == 'skipped')
uses: ./.github/workflows/ui_test_job.yml
needs: [
docker_build_scan_push,
create_tags
]
with:
run_against_image: true
tag: ${{ needs.create_tags.outputs.version_tag }}
specs: 'cypress/e2e/**/*.cy.js'
secrets:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
cypress_record_key: ${{ secrets.CYPRESS_RECORD_KEY }}
github_access_token: ${{ secrets.GITHUB_TOKEN }}
# ui_tests_image:
# name: Run Cypress UI Tests On Images
# if: needs.detect_changes.outputs.changes_detected == 'true' &&
# (needs.docker_build_scan_push.result == 'success' || needs.docker_build_scan_push.result == 'skipped')
# uses: ./.github/workflows/ui_test_job.yml
# needs: [
# docker_build_scan_push,
# create_tags
# ]
# with:
# run_against_image: true
# tag: ${{ needs.create_tags.outputs.version_tag }}
# specs: 'cypress/e2e/**/*.cy.js'
# secrets:
# aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
# cypress_record_key: ${{ secrets.CYPRESS_RECORD_KEY }}
# github_access_token: ${{ secrets.GITHUB_TOKEN }}

pr_deploy:
name: PR Environment Deploy
if: always() &&
(needs.go_unit_tests.result == 'success' || needs.go_unit_tests.result == 'skipped') &&
(needs.docker_build_scan_push.result == 'success' || needs.docker_build_scan_push.result == 'skipped') &&
(needs.ui_tests_image.result == 'success' || needs.ui_tests_image.result == 'skipped')
(needs.docker_build_scan_push.result == 'success' || needs.docker_build_scan_push.result == 'skipped')
# (needs.ui_tests_image.result == 'success' || needs.ui_tests_image.result == 'skipped')
needs: [
create_tags,
go_unit_tests,
docker_build_scan_push,
ui_tests_image
# ui_tests_image
]
uses: ./.github/workflows/terraform_environment_job.yml
with:
Expand Down Expand Up @@ -157,16 +157,19 @@ jobs:
cypress_record_key: ${{ secrets.CYPRESS_RECORD_KEY }}
github_access_token: ${{ secrets.GITHUB_TOKEN }}

always_remove_ingress:
name: Remove CI ingress from environment
if: always()
uses: ./.github/workflows/remove_ingress_job.yml
needs: [ui_tests_pr_env, pr_deploy]
with:
environment_config_json: ${{ needs.pr_deploy.outputs.environment_config_json }}
secrets:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}
# always_remove_ingress:
# name: Remove CI ingress from environment
# if: always()
# uses: ./.github/workflows/remove_ingress_job.yml
# needs: [
# # ui_tests_pr_env,
# pr_deploy
# ]
# with:
# environment_config_json: ${{ needs.pr_deploy.outputs.environment_config_json }}
# secrets:
# aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID_ACTIONS }}
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY_ACTIONS }}

end_of_pr_workflow:
name: End of PR Workflow
Expand All @@ -175,7 +178,11 @@ jobs:
environment:
name: "dev_${{ needs.create_tags.outputs.environment_workspace_name }}"
url: "https://${{ needs.pr_deploy.outputs.url }}"
needs: [pr_deploy, create_tags, ui_tests_pr_env]
needs: [
pr_deploy,
create_tags,
# ui_tests_pr_env
]
steps:
- name: End of PR Workflow
run: |
Expand Down
1 change: 1 addition & 0 deletions cmd/trigger_build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trigger a build
4 changes: 2 additions & 2 deletions docker/adot-collector/config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ receivers:
endpoint: "localhost:4318"

exporters:
logging:
debug:
awsxray:

service:
Expand All @@ -17,7 +17,7 @@ service:
exporters: [awsxray]
metrics:
receivers: [otlp]
exporters: [logging]
exporters: [debug]
telemetry:
metrics:
address: localhost:8888
Binary file removed docker/adot-collector/extensions/collector
Binary file not shown.
69 changes: 51 additions & 18 deletions docker/create-s3-replication-job/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
# FROM golang:1.23.5-alpine AS adot-builder-alpine-1
# WORKDIR /app
# RUN apk add --no-cache \
# git=2.47.2-r0 \
# bash=5.2.37-r0 \
# make=4.4.1-r2 \
# zip=3.0-r13 \
# unzip=6.0-r15 && \
# git clone https://github.com/aws-observability/aws-otel-collector
# WORKDIR /app/aws-otel-collector/
# RUN git checkout -b newbranch tags/v0.40.0
# RUN make amd64-build-only
# FROM golang:1.23.5-alpine AS adot-builder-alpine-2
# WORKDIR /app
# RUN apk add --no-cache \
# git=2.47.2-r0 \
# bash=5.2.37-r0 \
# make=4.4.1-r2 \
# zip=3.0-r13 \
# unzip=6.0-r15 && \
# git clone https://github.com/open-telemetry/opentelemetry-lambda
# WORKDIR /app/opentelemetry-lambda/
# # commit hash 21052d8 is 0.36.0
# RUN git checkout -b newbranch 21052d8
# WORKDIR /app/opentelemetry-lambda/collector
# RUN make package
FROM golang:1.23.5-alpine AS adot-builder-alpine
WORKDIR /app
RUN apk add --no-cache \
git=2.47.2-r0 \
bash=5.2.37-r0 \
make=4.4.1-r2 \
zip=3.0-r13 \
unzip=6.0-r15 && \
git clone --recurse-submodules https://github.com/aws-observability/aws-otel-lambda
WORKDIR /app/aws-otel-lambda/
# commit hash 84e2c7fe8444c7476cf7eb6d97c009dac4da1615 is collector layer v0.42.0
# commit hash b00475323dc3f1964151770dbea82d308d6924e3 is collector layer v0.36.0
RUN git checkout -b newbranch b00475323dc3f1964151770dbea82d308d6924e3
WORKDIR /app/aws-otel-lambda/opentelemetry-lambda/collector
RUN make package

FROM golang:1.23.5-alpine AS build

WORKDIR /app
Expand All @@ -10,20 +52,6 @@ COPY --link internal ./internal

RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -o create-s3-replication-job ./cmd/create-s3-replication-job

FROM public.ecr.aws/lambda/provided:al2023.2024.10.14.12 AS dev

WORKDIR /app

COPY --from=build /app/create-s3-replication-job /var/task/create-s3-replication-job
COPY --link lang ./lang
COPY --link ./docker/adot-collector/ /opt
COPY --link docker/aws-lambda-rie ./aws-lambda-rie

ENV AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler
ENV OPENTELEMETRY_COLLECTOR_CONFIG_FILE="/opt/config/config.yaml"

ENTRYPOINT ["./create-s3-replication-job"]

FROM public.ecr.aws/lambda/provided:al2023.2024.10.14.12 AS production

WORKDIR /app
Expand All @@ -33,12 +61,17 @@ RUN chmod +x "/app/install_lambda_insights.sh" \
&& /app/install_lambda_insights.sh "${TARGETPLATFORM}"

COPY --from=build /app/create-s3-replication-job ./create-s3-replication-job
COPY --link lang ./lang
COPY --link ./docker/adot-collector/ /opt
COPY --link ./docker/adot-collector/config/config.yaml /opt/collector-config/config.yaml
#1
# COPY --from=adot-builder-alpine /app/aws-otel-collector/build/linux/amd64/aoc /opt/extensions/collector
# 2
# COPY --from=adot-builder-alpine /app/opentelemetry-lambda/collector/build/extensions/collector /opt/extensions/collector
# 3
COPY --from=adot-builder-alpine /app/aws-otel-lambda/opentelemetry-lambda/collector/build/extensions/collector /opt/extensions/collector

RUN chmod 755 /opt/config/config.yaml
RUN chmod 755 /opt/collector-config/config.yaml

ENV AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler
ENV OPENTELEMETRY_COLLECTOR_CONFIG_FILE="/opt/config/config.yaml"
ENV OPENTELEMETRY_COLLECTOR_CONFIG_URI="/opt/collector-config/config.yaml"

ENTRYPOINT ["./create-s3-replication-job"]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ module "s3_create_batch_replication_jobs" {
lambda_name = "create-s3-batch-replication-jobs"
description = "Function to create and run batch replication jobs in ${data.aws_region.current.name}"
environment_variables = {
ENVIRONMENT = data.aws_default_tags.current.tags.environment-name
ENVIRONMENT = data.aws_default_tags.current.tags.environment-name
OPENTELEMETRY_COLLECTOR_CONFIG_URI = "/opt/collector-config/config.yaml"
}
image_uri = "${var.s3_replication.lambda_function_image_ecr_url}:${var.s3_replication.lambda_function_image_tag}"
aws_iam_role = var.create_s3_batch_replication_jobs_lambda_iam_role
Expand Down

0 comments on commit 5bd0fe7

Please sign in to comment.