From 888dc70f828f492450d077b215976441f41d4e39 Mon Sep 17 00:00:00 2001 From: Maxime Hugues Date: Thu, 27 Mar 2025 10:34:31 -0500 Subject: [PATCH] Add autobuild of efa node exporter --- .../3.efa-node-exporter/buildspec.yaml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 4.validation_and_observability/3.efa-node-exporter/buildspec.yaml diff --git a/4.validation_and_observability/3.efa-node-exporter/buildspec.yaml b/4.validation_and_observability/3.efa-node-exporter/buildspec.yaml new file mode 100644 index 000000000..0e67ba56a --- /dev/null +++ b/4.validation_and_observability/3.efa-node-exporter/buildspec.yaml @@ -0,0 +1,38 @@ +version: 0.2 + +env: + variables: + NODE_EXPORTER_VERSION: "v1.9.0" + PROCFS_EXPORTER_VERSION: "v0.16.0" + GOLANG_VERSION: "1.24.1" + exported-variables: + - NODE_EXPORTER_VERSION + - PROCFS_EXPORTER_VERSION + - GOLANG_VERSION +phases: + pre_build: + commands: + - export TAG="node-exporter${NODE_EXPORTER_VERSION}-procs${PROCFS_EXPORTER_VERSION}" + - echo "TAG=$TAG" + - export REPO_COUNT="$(aws ecr describe-repositories | grep repositoryName | grep \"${ECR_REPOSITORY_NAME}\" | wc -l)" + - if [ "$REPO_COUNT" == 0 ]; then aws ecr create-repository --repository-name ${ECR_REPOSITORY_NAME}; else echo "Repository ${ECR_REPOSITORY_NAME} already exists"; fi + build: + commands: + - export REPO_URI="$(aws ecr describe-repositories | grep repositoryUri | grep /${ECR_REPOSITORY_NAME}\" | cut -d '"' -f 4)" + - echo "REPO_URI=$REPO_URI" + - echo "Building ${REPO_URI}:${TAG} ..." + - cd 4.validation_and_observability/3.efa-node-exporter && docker image build --build-arg NODE_EXPORTER_VERSION=$NODE_EXPORTER_VERSION --build-arg PROCFS_EXPORTER_VERSION=$PROCFS_EXPORTER_VERSION --build-arg GOLANG_VERSION=$GOLANG_VERSION -t ${REPO_URI}:${TAG} -f ./Dockerfile . + post_build: + commands: + - export ECR_URI=${REPO_URI%"/${ECR_REPOSITORY_NAME}"} + - echo "Logging in to ECR_URI $ECR_URI" + - aws ecr get-login-password | docker login --username AWS --password-stdin ${ECR_URI} + - docker image push ${REPO_URI}:${TAG} + - docker image tag ${REPO_URI}:${TAG} ${REPO_URI}:latest + - docker image push ${REPO_URI}:latest + - aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws + - docker image tag ${REPO_URI}:${TAG} public.ecr.aws/hpc-cloud/${ECR_REPOSITORY_NAME}:${TAG} + - docker image tag ${REPO_URI}:${TAG} public.ecr.aws/hpc-cloud/${ECR_REPOSITORY_NAME}:latest + - docker push public.ecr.aws/hpc-cloud/${ECR_REPOSITORY_NAME}:${TAG} + - docker push public.ecr.aws/hpc-cloud/${ECR_REPOSITORY_NAME}:latest +