forked from tensorzero/tensorzero
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-gateway-e2e-container.yml
More file actions
62 lines (51 loc) · 2.33 KB
/
build-gateway-e2e-container.yml
File metadata and controls
62 lines (51 loc) · 2.33 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Build Gateway Container
on:
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
env:
TAG: tensorzero/gateway-e2e:sha-${{ github.sha }}
LATEST_TAG: tensorzero/gateway-e2e:latest
jobs:
build-gateway-container:
runs-on: ubuntu-latest
if: github.repository == 'tensorzero/tensorzero'
permissions:
# Permission to checkout the repository
contents: read
# Permission to fetch GitHub OIDC token authentication
id-token: write
steps:
# TODO - investigate why using the Namespace checkout action causes
# 'tensorzero_core::built_info::GIT_COMMIT_HASH_SHORT' to be `None`
- name: Check out the repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Login to DockerHub
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# We allow the namespace builder setup to fail on Dependabot PRs and PRs from forks
# (where the oidc token is not available)
- name: Install Namespace CLI
uses: namespacelabs/nscloud-setup@d1c625762f7c926a54bd39252efff0705fd11c64
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
- name: Configure Namespace-powered Buildx
uses: namespacelabs/nscloud-setup-buildx-action@91c2e6537780e3b092cb8476406be99a8f91bd5e
with:
wait-for-builder: true
continue-on-error: ${{ github.event.pull_request.head.repo.full_name != github.repository || github.actor == 'dependabot[bot]' }}
- name: Pull latest image for caching (ignore errors if image doesn't exist)
run: docker pull $LATEST_TAG || true
- name: Build `gateway-e2e` container
run: docker build --load --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 --build-arg PROFILE=release --build-arg CARGO_BUILD_FLAGS="--features e2e_tests" --cache-from $LATEST_TAG -f gateway/Dockerfile . -t $TAG
- name: Tag latest image and push both tags
run: |
docker tag $TAG $LATEST_TAG
echo "Pushing $TAG"
docker push $TAG
echo "Pushing $LATEST_TAG"
docker push $LATEST_TAG