Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions 4.validation_and_observability/3.efa-node-exporter/buildspec.yaml
Original file line number Diff line number Diff line change
@@ -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