forked from blib-la/runpod-worker-comfy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
40 lines (38 loc) · 1.76 KB
/
buildspec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
version: 0.2
env:
secrets-manager:
DEPOT_TOKEN: "arn:aws:secretsmanager:us-west-2:412414942595:secret:depot-user-api-jIBXlU:DEPOT_TOKEN"
WEBHOOK_API_KEY: "arn:aws:secretsmanager:us-west-2:412414942595:secret:depot-user-api-jIBXlU:WEBHOOK_API_KEY"
DOCKER_AUTH: "arn:aws:secretsmanager:us-west-2:412414942595:secret:depot-user-api-jIBXlU:DOCKER_AUTH"
variables:
MACHINE_ID: ${MACHINE_ID}
WEBHOOK_ENDPOINT: ${WEBHOOK_ENDPOINT}
phases:
pre_build:
commands:
- ecr_stdin=$(aws ecr get-login-password --region us-west-2)
- registry_auth=$(printf "AWS:$ecr_stdin" | openssl base64 -A)
- mkdir $HOME/.docker
- echo "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"$DOCKER_AUTH\"}}}" > $HOME/.docker/config.json
- echo Installing Depot CLI...
- curl -L https://depot.dev/install-cli.sh | DEPOT_INSTALL_DIR="/tmp/codebuild/bin" sh
build:
commands:
- depot build -t $IMAGE_NAME --push --platform linux/amd64 --build-arg DEPS_JSON="$DEPS_JSON" .
- BUILD_STATUS=$?
post_build:
commands:
- echo $WEBHOOK_ENDPOINT
- BUILD_ID=$(echo $CODEBUILD_BUILD_ID | cut -d':' -f2)
- |
if [ $BUILD_STATUS -eq 0 ]; then
curl -X POST "$WEBHOOK_ENDPOINT" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $WEBHOOK_API_KEY" \
-d "{\"machineID\":\"$MACHINE_ID\",\"buildID\":\"$BUILD_ID\",\"imageName\":\"$IMAGE_NAME\",\"status\":\"SUCCESS\"}"
else
curl -X POST "$WEBHOOK_ENDPOINT" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $WEBHOOK_API_KEY" \
-d "{\"machineID\":\"$MACHINE_ID\",\"buildID\":\"$BUILD_ID\",\"imageName\":\"$IMAGE_NAME\",\"status\":\"FAIL\"}"
fi