Skip to content

Commit 5ca949c

Browse files
committed
Merge tag 'v0.12.0' into update/upstream-0.12.0
2 parents 3cb6f94 + 593b18f commit 5ca949c

File tree

739 files changed

+47707
-14736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

739 files changed

+47707
-14736
lines changed

.github/actions/custom-build-and-push/action.yml

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,20 @@ inputs:
3232
description: 'Cache destinations'
3333
required: false
3434
retry-wait-time:
35-
description: 'Time to wait before retry in seconds'
35+
description: 'Time to wait before attempt 2 in seconds'
3636
required: false
37-
default: '5'
37+
default: '60'
38+
retry-wait-time-2:
39+
description: 'Time to wait before attempt 3 in seconds'
40+
required: false
41+
default: '120'
3842

3943
runs:
4044
using: "composite"
4145
steps:
42-
- name: Build and push Docker image (First Attempt)
46+
- name: Build and push Docker image (Attempt 1 of 3)
4347
id: buildx1
44-
uses: docker/build-push-action@v5
48+
uses: docker/build-push-action@v6
4549
continue-on-error: true
4650
with:
4751
context: ${{ inputs.context }}
@@ -54,16 +58,39 @@ runs:
5458
cache-from: ${{ inputs.cache-from }}
5559
cache-to: ${{ inputs.cache-to }}
5660

57-
- name: Wait to retry
61+
- name: Wait before attempt 2
5862
if: steps.buildx1.outcome != 'success'
5963
run: |
6064
echo "First attempt failed. Waiting ${{ inputs.retry-wait-time }} seconds before retry..."
6165
sleep ${{ inputs.retry-wait-time }}
6266
shell: bash
6367

64-
- name: Build and push Docker image (Retry Attempt)
68+
- name: Build and push Docker image (Attempt 2 of 3)
69+
id: buildx2
6570
if: steps.buildx1.outcome != 'success'
66-
uses: docker/build-push-action@v5
71+
uses: docker/build-push-action@v6
72+
with:
73+
context: ${{ inputs.context }}
74+
file: ${{ inputs.file }}
75+
platforms: ${{ inputs.platforms }}
76+
pull: ${{ inputs.pull }}
77+
push: ${{ inputs.push }}
78+
load: ${{ inputs.load }}
79+
tags: ${{ inputs.tags }}
80+
cache-from: ${{ inputs.cache-from }}
81+
cache-to: ${{ inputs.cache-to }}
82+
83+
- name: Wait before attempt 3
84+
if: steps.buildx1.outcome != 'success' && steps.buildx2.outcome != 'success'
85+
run: |
86+
echo "Second attempt failed. Waiting ${{ inputs.retry-wait-time-2 }} seconds before retry..."
87+
sleep ${{ inputs.retry-wait-time-2 }}
88+
shell: bash
89+
90+
- name: Build and push Docker image (Attempt 3 of 3)
91+
id: buildx3
92+
if: steps.buildx1.outcome != 'success' && steps.buildx2.outcome != 'success'
93+
uses: docker/build-push-action@v6
6794
with:
6895
context: ${{ inputs.context }}
6996
file: ${{ inputs.file }}
@@ -74,3 +101,9 @@ runs:
74101
tags: ${{ inputs.tags }}
75102
cache-from: ${{ inputs.cache-from }}
76103
cache-to: ${{ inputs.cache-to }}
104+
105+
- name: Report failure
106+
if: steps.buildx1.outcome != 'success' && steps.buildx2.outcome != 'success' && steps.buildx3.outcome != 'success'
107+
run: |
108+
echo "All attempts failed. Possible transient infrastucture issues? Try again later or inspect logs for details."
109+
shell: bash

.github/pull_request_template.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,24 @@
66
[Describe the tests you ran to verify your changes]
77

88

9-
## Accepted Risk
10-
[Any know risks or failure modes to point out to reviewers]
9+
## Accepted Risk (provide if relevant)
10+
N/A
1111

1212

13-
## Related Issue(s)
14-
[If applicable, link to the issue(s) this PR addresses]
13+
## Related Issue(s) (provide if relevant)
14+
N/A
1515

1616

17-
## Checklist:
18-
- [ ] All of the automated tests pass
19-
- [ ] All PR comments are addressed and marked resolved
20-
- [ ] If there are migrations, they have been rebased to latest main
21-
- [ ] If there are new dependencies, they are added to the requirements
22-
- [ ] If there are new environment variables, they are added to all of the deployment methods
23-
- [ ] If there are new APIs that don't require auth, they are added to PUBLIC_ENDPOINT_SPECS
24-
- [ ] Docker images build and basic functionalities work
25-
- [ ] Author has done a final read through of the PR right before merge
17+
## Mental Checklist:
18+
- All of the automated tests pass
19+
- All PR comments are addressed and marked resolved
20+
- If there are migrations, they have been rebased to latest main
21+
- If there are new dependencies, they are added to the requirements
22+
- If there are new environment variables, they are added to all of the deployment methods
23+
- If there are new APIs that don't require auth, they are added to PUBLIC_ENDPOINT_SPECS
24+
- Docker images build and basic functionalities work
25+
- Author has done a final read through of the PR right before merge
26+
27+
## Backporting (check the box to trigger backport action)
28+
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.
29+
- [ ] This PR should be backported (make sure to check that the backport attempt succeeds)
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: Build and Push Cloud Web Image on Tag
2+
# Identical to the web container build, but with correct image tag and build args
3+
4+
on:
5+
push:
6+
tags:
7+
- '*'
8+
9+
env:
10+
REGISTRY_IMAGE: danswer/danswer-cloud-web-server
11+
LATEST_TAG: ${{ contains(github.ref_name, 'latest') }}
12+
13+
jobs:
14+
build:
15+
runs-on:
16+
- runs-on
17+
- runner=${{ matrix.platform == 'linux/amd64' && '8cpu-linux-x64' || '8cpu-linux-arm64' }}
18+
- run-id=${{ github.run_id }}
19+
- tag=platform-${{ matrix.platform }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
platform:
24+
- linux/amd64
25+
- linux/arm64
26+
27+
steps:
28+
- name: Prepare
29+
run: |
30+
platform=${{ matrix.platform }}
31+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
32+
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Docker meta
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY_IMAGE }}
41+
tags: |
42+
type=raw,value=${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}
43+
type=raw,value=${{ env.LATEST_TAG == 'true' && format('{0}:latest', env.REGISTRY_IMAGE) || '' }}
44+
45+
- name: Set up Docker Buildx
46+
uses: docker/setup-buildx-action@v3
47+
48+
- name: Login to Docker Hub
49+
uses: docker/login-action@v3
50+
with:
51+
username: ${{ secrets.DOCKER_USERNAME }}
52+
password: ${{ secrets.DOCKER_TOKEN }}
53+
54+
- name: Build and push by digest
55+
id: build
56+
uses: docker/build-push-action@v5
57+
with:
58+
context: ./web
59+
file: ./web/Dockerfile
60+
platforms: ${{ matrix.platform }}
61+
push: true
62+
build-args: |
63+
DANSWER_VERSION=${{ github.ref_name }}
64+
NEXT_PUBLIC_CLOUD_ENABLED=true
65+
NEXT_PUBLIC_POSTHOG_KEY=${{ secrets.POSTHOG_KEY }}
66+
NEXT_PUBLIC_POSTHOG_HOST=${{ secrets.POSTHOG_HOST }}
67+
NEXT_PUBLIC_SENTRY_DSN=${{ secrets.SENTRY_DSN }}
68+
# needed due to weird interactions with the builds for different platforms
69+
no-cache: true
70+
labels: ${{ steps.meta.outputs.labels }}
71+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
72+
73+
- name: Export digest
74+
run: |
75+
mkdir -p /tmp/digests
76+
digest="${{ steps.build.outputs.digest }}"
77+
touch "/tmp/digests/${digest#sha256:}"
78+
79+
- name: Upload digest
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: digests-${{ env.PLATFORM_PAIR }}
83+
path: /tmp/digests/*
84+
if-no-files-found: error
85+
retention-days: 1
86+
87+
merge:
88+
runs-on: ubuntu-latest
89+
needs:
90+
- build
91+
steps:
92+
- name: Download digests
93+
uses: actions/download-artifact@v4
94+
with:
95+
path: /tmp/digests
96+
pattern: digests-*
97+
merge-multiple: true
98+
99+
- name: Set up Docker Buildx
100+
uses: docker/setup-buildx-action@v3
101+
102+
- name: Docker meta
103+
id: meta
104+
uses: docker/metadata-action@v5
105+
with:
106+
images: ${{ env.REGISTRY_IMAGE }}
107+
108+
- name: Login to Docker Hub
109+
uses: docker/login-action@v3
110+
with:
111+
username: ${{ secrets.DOCKER_USERNAME }}
112+
password: ${{ secrets.DOCKER_TOKEN }}
113+
114+
- name: Create manifest list and push
115+
working-directory: /tmp/digests
116+
run: |
117+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
118+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
119+
120+
- name: Inspect image
121+
run: |
122+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
123+
124+
# trivy has their own rate limiting issues causing this action to flake
125+
# we worked around it by hardcoding to different db repos in env
126+
# can re-enable when they figure it out
127+
# https://github.com/aquasecurity/trivy/discussions/7538
128+
# https://github.com/aquasecurity/trivy-action/issues/389
129+
- name: Run Trivy vulnerability scanner
130+
uses: aquasecurity/trivy-action@master
131+
env:
132+
TRIVY_DB_REPOSITORY: 'public.ecr.aws/aquasecurity/trivy-db:2'
133+
TRIVY_JAVA_DB_REPOSITORY: 'public.ecr.aws/aquasecurity/trivy-java-db:1'
134+
with:
135+
image-ref: docker.io/${{ env.REGISTRY_IMAGE }}:${{ github.ref_name }}
136+
severity: 'CRITICAL,HIGH'

0 commit comments

Comments
 (0)