Skip to content

Commit fc424ff

Browse files
committed
Merge branch 'temp3_for-taruntarun' into for-taruntarun
2 parents dad0dec + f8df65f commit fc424ff

619 files changed

Lines changed: 9351 additions & 6425 deletions

File tree

Some content is hidden

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

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22

33
orbs:
4-
ruby: circleci/ruby@2.3.0
4+
ruby: circleci/ruby@2.3.1
55
node: circleci/node@7.0.0
66

77
executors:
@@ -23,7 +23,7 @@ executors:
2323
environment:
2424
POSTGRES_USER: root
2525
POSTGRES_HOST_AUTH_METHOD: trust
26-
- image: cimg/redis:7.4.1
26+
- image: cimg/redis:7.4.2
2727

2828
commands:
2929
install-system-dependencies:
@@ -36,10 +36,10 @@ commands:
3636
prepare-yarn:
3737
steps:
3838
- run:
39-
name: Specification version of yarn to 4.5.3
39+
name: Specification version of yarn to 4.6.0
4040
command: |
4141
sudo corepack enable
42-
sudo COREPACK_ENABLE_DOWNLOAD_PROMPT=0 yarn set version 4.5.3
42+
sudo COREPACK_ENABLE_DOWNLOAD_PROMPT=0 yarn set version 4.6.0
4343
install-ruby-dependencies:
4444
parameters:
4545
ruby-version:
@@ -52,7 +52,7 @@ commands:
5252
bundle config without 'development production'
5353
name: Set bundler settings
5454
- ruby/install-deps:
55-
bundler-version: '2.6.1'
55+
bundler-version: '2.6.3'
5656
key: ruby<< parameters.ruby-version >>-gems-v2
5757
wait-db:
5858
steps:

.devcontainer/compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ services:
1010
RAILS_ENV: development
1111
NODE_ENV: development
1212
BIND: 0.0.0.0
13+
BOOTSNAP_CACHE_DIR: /tmp
1314
REDIS_HOST: redis
1415
REDIS_PORT: '6379'
1516
DB_HOST: db

.env.production.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ OTP_SECRET=
5151
# Must be available (and set to same values) for all server processes
5252
# These are private/secret values, do not share outside hosting environment
5353
# Use `bin/rails db:encryption:init` to generate fresh secrets
54-
# Do not change these secrets once in use, as this would cause data loss and other issues
54+
# Do NOT change these secrets once in use, as this would cause data loss and other issues
5555
# ------------------
5656
# ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=
5757
# ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=
Lines changed: 106 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
on:
22
workflow_call:
33
inputs:
4-
platforms:
5-
required: true
6-
type: string
74
cache:
85
type: boolean
96
default: true
10-
use_native_arm64_builder:
11-
type: boolean
127
push_to_images:
138
type: string
149
version_prerelease:
@@ -24,42 +19,36 @@ on:
2419
file_to_build:
2520
type: string
2621

22+
# This builds multiple images with one runner each, allowing us to build for multiple architectures
23+
# using Github's runners.
24+
# The two-step process is adapted form:
25+
# https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners
2726
jobs:
27+
# Build each (amd64 and arm64) image separately
2828
build-image:
29-
runs-on: ubuntu-latest
29+
runs-on: ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
platform:
34+
- linux/amd64
35+
- linux/arm64
3036

3137
steps:
3238
- uses: actions/checkout@v4
3339

34-
- uses: docker/setup-qemu-action@v3
35-
if: contains(inputs.platforms, 'linux/arm64') && !inputs.use_native_arm64_builder
36-
37-
- uses: docker/setup-buildx-action@v3
38-
id: buildx
39-
if: ${{ !(inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64')) }}
40-
41-
- name: Start a local Docker Builder
42-
if: inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64')
40+
- name: Prepare
41+
env:
42+
PUSH_TO_IMAGES: ${{ inputs.push_to_images }}
4343
run: |
44-
docker run --rm -d --name buildkitd -p 1234:1234 --privileged moby/buildkit:latest --addr tcp://0.0.0.0:1234
44+
platform=${{ matrix.platform }}
45+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
46+
# Transform multi-line variable into comma-separated variable
47+
image_names=${PUSH_TO_IMAGES//$'\n'/,}
48+
echo "IMAGE_NAMES=${image_names%,}" >> $GITHUB_ENV
4549
4650
- uses: docker/setup-buildx-action@v3
47-
id: buildx-native
48-
if: inputs.use_native_arm64_builder && contains(inputs.platforms, 'linux/arm64')
49-
with:
50-
driver: remote
51-
endpoint: tcp://localhost:1234
52-
platforms: linux/amd64
53-
append: |
54-
- endpoint: tcp://${{ vars.DOCKER_BUILDER_HETZNER_ARM64_01_HOST }}:13865
55-
platforms: linux/arm64
56-
name: mastodon-docker-builder-arm64-01
57-
driver-opts:
58-
- servername=mastodon-docker-builder-arm64-01
59-
env:
60-
BUILDER_NODE_1_AUTH_TLS_CACERT: ${{ secrets.DOCKER_BUILDER_HETZNER_ARM64_01_CACERT }}
61-
BUILDER_NODE_1_AUTH_TLS_CERT: ${{ secrets.DOCKER_BUILDER_HETZNER_ARM64_01_CERT }}
62-
BUILDER_NODE_1_AUTH_TLS_KEY: ${{ secrets.DOCKER_BUILDER_HETZNER_ARM64_01_KEY }}
51+
id: buildx
6352

6453
- name: Log in to Docker Hub
6554
if: contains(inputs.push_to_images, 'tootsuite')
@@ -76,28 +65,106 @@ jobs:
7665
username: ${{ github.actor }}
7766
password: ${{ secrets.GITHUB_TOKEN }}
7867

79-
- uses: docker/metadata-action@v5
68+
- name: Docker meta
8069
id: meta
70+
uses: docker/metadata-action@v5
8171
if: ${{ inputs.push_to_images != '' }}
8272
with:
8373
images: ${{ inputs.push_to_images }}
8474
flavor: ${{ inputs.flavor }}
85-
tags: ${{ inputs.tags }}
8675
labels: ${{ inputs.labels }}
8776

88-
- uses: docker/build-push-action@v6
77+
- name: Build and push by digest
78+
id: build
79+
uses: docker/build-push-action@v6
8980
with:
9081
context: .
9182
file: ${{ inputs.file_to_build }}
9283
build-args: |
9384
MASTODON_VERSION_PRERELEASE=${{ inputs.version_prerelease }}
9485
MASTODON_VERSION_METADATA=${{ inputs.version_metadata }}
9586
SOURCE_COMMIT=${{ github.sha }}
96-
platforms: ${{ inputs.platforms }}
87+
platforms: ${{ matrix.platform }}
9788
provenance: false
98-
builder: ${{ steps.buildx.outputs.name || steps.buildx-native.outputs.name }}
9989
push: ${{ inputs.push_to_images != '' }}
100-
tags: ${{ steps.meta.outputs.tags }}
101-
labels: ${{ steps.meta.outputs.labels }}
10290
cache-from: ${{ inputs.cache && 'type=gha' || '' }}
10391
cache-to: ${{ inputs.cache && 'type=gha,mode=max' || '' }}
92+
outputs: type=image,"name=${{ env.IMAGE_NAMES }}",push-by-digest=true,name-canonical=true,push=${{ inputs.push_to_images != '' }}
93+
94+
- name: Export digest
95+
if: ${{ inputs.push_to_images != '' }}
96+
run: |
97+
mkdir -p "${{ runner.temp }}/digests"
98+
digest="${{ steps.build.outputs.digest }}"
99+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
100+
101+
- name: Upload digest
102+
if: ${{ inputs.push_to_images != '' }}
103+
uses: actions/upload-artifact@v4
104+
with:
105+
# `hashFiles` is used to disambiguate between streaming and non-streaming images
106+
name: digests-${{ hashFiles(inputs.file_to_build) }}-${{ env.PLATFORM_PAIR }}
107+
path: ${{ runner.temp }}/digests/*
108+
if-no-files-found: error
109+
retention-days: 1
110+
111+
# Then merge the docker images into a single one
112+
merge-images:
113+
if: ${{ inputs.push_to_images != '' }}
114+
runs-on: ubuntu-24.04
115+
needs:
116+
- build-image
117+
118+
env:
119+
PUSH_TO_IMAGES: ${{ inputs.push_to_images }}
120+
121+
steps:
122+
- uses: actions/checkout@v4
123+
124+
- name: Download digests
125+
uses: actions/download-artifact@v4
126+
with:
127+
path: ${{ runner.temp }}/digests
128+
# `hashFiles` is used to disambiguate between streaming and non-streaming images
129+
pattern: digests-${{ hashFiles(inputs.file_to_build) }}-*
130+
merge-multiple: true
131+
132+
- name: Log in to Docker Hub
133+
if: contains(inputs.push_to_images, 'tootsuite')
134+
uses: docker/login-action@v3
135+
with:
136+
username: ${{ secrets.DOCKERHUB_USERNAME }}
137+
password: ${{ secrets.DOCKERHUB_TOKEN }}
138+
139+
- name: Log in to the GitHub Container registry
140+
if: contains(inputs.push_to_images, 'ghcr.io')
141+
uses: docker/login-action@v3
142+
with:
143+
registry: ghcr.io
144+
username: ${{ github.actor }}
145+
password: ${{ secrets.GITHUB_TOKEN }}
146+
147+
- name: Set up Docker Buildx
148+
uses: docker/setup-buildx-action@v3
149+
150+
- name: Docker meta
151+
id: meta
152+
uses: docker/metadata-action@v5
153+
if: ${{ inputs.push_to_images != '' }}
154+
with:
155+
images: ${{ inputs.push_to_images }}
156+
flavor: ${{ inputs.flavor }}
157+
tags: ${{ inputs.tags }}
158+
labels: ${{ inputs.labels }}
159+
160+
- name: Create manifest list and push
161+
working-directory: ${{ runner.temp }}/digests
162+
run: |
163+
echo "$PUSH_TO_IMAGES" | xargs -I{} \
164+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
165+
$(printf '{}@sha256:%s ' *)
166+
167+
- name: Inspect image
168+
run: |
169+
echo "$PUSH_TO_IMAGES" | xargs -i{} \
170+
docker buildx imagetools inspect {}:${{ steps.meta.outputs.version }}

.github/workflows/build-nightly.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626
uses: ./.github/workflows/build-container-image.yml
2727
with:
2828
file_to_build: Dockerfile
29-
platforms: linux/amd64,linux/arm64
30-
use_native_arm64_builder: true
3129
cache: false
3230
push_to_images: |
3331
tootsuite/mastodon
@@ -48,8 +46,6 @@ jobs:
4846
uses: ./.github/workflows/build-container-image.yml
4947
with:
5048
file_to_build: streaming/Dockerfile
51-
platforms: linux/amd64,linux/arm64
52-
use_native_arm64_builder: true
5349
cache: false
5450
push_to_images: |
5551
tootsuite/mastodon-streaming

.github/workflows/build-push-pr.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ jobs:
3232
uses: ./.github/workflows/build-container-image.yml
3333
with:
3434
file_to_build: Dockerfile
35-
platforms: linux/amd64,linux/arm64
36-
use_native_arm64_builder: true
3735
push_to_images: |
3836
ghcr.io/mastodon/mastodon
3937
version_metadata: ${{ needs.compute-suffix.outputs.metadata }}
@@ -49,8 +47,6 @@ jobs:
4947
uses: ./.github/workflows/build-container-image.yml
5048
with:
5149
file_to_build: streaming/Dockerfile
52-
platforms: linux/amd64,linux/arm64
53-
use_native_arm64_builder: true
5450
push_to_images: |
5551
ghcr.io/mastodon/mastodon-streaming
5652
version_metadata: ${{ needs.compute-suffix.outputs.metadata }}

.github/workflows/build-releases.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ jobs:
1313
uses: ./.github/workflows/build-container-image.yml
1414
with:
1515
file_to_build: Dockerfile
16-
platforms: linux/amd64,linux/arm64
17-
use_native_arm64_builder: true
1816
push_to_images: |
1917
tootsuite/mastodon
2018
ghcr.io/mastodon/mastodon
@@ -34,8 +32,6 @@ jobs:
3432
uses: ./.github/workflows/build-container-image.yml
3533
with:
3634
file_to_build: streaming/Dockerfile
37-
platforms: linux/amd64,linux/arm64
38-
use_native_arm64_builder: true
3935
push_to_images: |
4036
tootsuite/mastodon-streaming
4137
ghcr.io/mastodon/mastodon-streaming

.github/workflows/build-security.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ jobs:
2424
uses: ./.github/workflows/build-container-image.yml
2525
with:
2626
file_to_build: Dockerfile
27-
platforms: linux/amd64,linux/arm64
28-
use_native_arm64_builder: true
2927
cache: false
3028
push_to_images: |
3129
tootsuite/mastodon
@@ -46,8 +44,6 @@ jobs:
4644
uses: ./.github/workflows/build-container-image.yml
4745
with:
4846
file_to_build: streaming/Dockerfile
49-
platforms: linux/amd64,linux/arm64
50-
use_native_arm64_builder: true
5147
cache: false
5248
push_to_images: |
5349
tootsuite/mastodon-streaming

.github/workflows/test-image-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
uses: ./.github/workflows/build-container-image.yml
2121
with:
2222
file_to_build: Dockerfile
23-
platforms: linux/amd64 # Testing only on native platform so it is performant
2423
cache: true
2524

2625
build-image-streaming:
@@ -31,5 +30,4 @@ jobs:
3130
uses: ./.github/workflows/build-container-image.yml
3231
with:
3332
file_to_build: streaming/Dockerfile
34-
platforms: linux/amd64 # Testing only on native platform so it is performant
3533
cache: true

.github/workflows/test-migrations.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ jobs:
6464
DB_HOST: localhost
6565
DB_USER: postgres
6666
DB_PASS: postgres
67-
DISABLE_SIMPLECOV: true
6867
RAILS_ENV: test
6968
BUNDLE_CLEAN: true
7069
BUNDLE_FROZEN: true

0 commit comments

Comments
 (0)