Skip to content

Commit 559e732

Browse files
authored
breaking: Upgrade min Compose version to 2.23.2 (#3535)
In this version, there's a new `--pull` argument for `docker compose run` which we will start leveraging, especially with `sentry-admin` command. Should come with a slight speed boost.
1 parent 3913a9f commit 559e732

File tree

7 files changed

+35
-30
lines changed

7 files changed

+35
-30
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
- name: Checkout
2828
uses: actions/checkout@v4
2929

30+
- name: Get Compose
31+
uses: ./get-compose-action
32+
3033
- name: Unit Tests
3134
run: ./unit-test.sh
3235

@@ -42,20 +45,15 @@ jobs:
4245
LATEST_TAG=$(curl -s https://api.github.com/repos/getsentry/self-hosted/releases/latest | jq -r '.tag_name')
4346
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
4447
48+
- name: Get Compose
49+
# TODO: Replace this with `@master` after landing
50+
uses: getsentry/self-hosted/get-compose-action@byk/ref/upgrade-compose
51+
4552
- name: Checkout latest release
4653
uses: actions/checkout@v4
4754
with:
4855
ref: ${{ env.LATEST_TAG }}
4956

50-
- name: Get Compose
51-
run: |
52-
# Docker Compose v1 is installed here, remove it
53-
sudo rm -f "/usr/local/bin/docker-compose"
54-
sudo rm -f "/usr/local/lib/docker/cli-plugins/docker-compose"
55-
sudo mkdir -p "/usr/local/lib/docker/cli-plugins"
56-
sudo curl -L https://github.com/docker/compose/releases/download/v2.26.0/docker-compose-`uname -s`-`uname -m` -o "/usr/local/lib/docker/cli-plugins/docker-compose"
57-
sudo chmod +x "/usr/local/lib/docker/cli-plugins/docker-compose"
58-
5957
- name: Restore DB Volumes Cache
6058
id: restore_cache
6159
uses: BYK/docker-volume-cache-action/restore@be89365902126f508dcae387a32ec3712df6b1cd

_unit-test/js-sdk-assets-test.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
source _unit-test/_test_setup.sh
44
source install/dc-detect-version.sh
55
$dcb --force-rm web
6+
$dc pull nginx
67

78
export SETUP_JS_SDK_ASSETS=1
89

910
source install/setup-js-sdk-assets.sh
1011

11-
sdk_files=$(docker compose run --no-deps --rm -v "sentry-nginx-www:/var/www" nginx ls -lah /var/www/js-sdk/)
12-
sdk_tree=$(docker compose run --no-deps --rm -v "sentry-nginx-www:/var/www" nginx tree /var/www/js-sdk/ | tail -n 1)
13-
non_empty_file_count=$(docker compose run --no-deps --rm -v "sentry-nginx-www:/var/www" nginx find /var/www/js-sdk/ -type f -size +1k | wc -l)
12+
sdk_files=$($dcr --no-deps -v "sentry-nginx-www:/var/www" nginx ls -lah /var/www/js-sdk/)
13+
sdk_tree=$($dcr --no-deps -v "sentry-nginx-www:/var/www" nginx tree /var/www/js-sdk/ | tail -n 1)
14+
non_empty_file_count=$($dcr --no-deps -v "sentry-nginx-www:/var/www" nginx find /var/www/js-sdk/ -type f -size +1k | wc -l)
1415

1516
# `sdk_files` should contains 5 lines, '4.*', '5.*', '6.*', `7.*` and `8.*`
1617
echo $sdk_files

action.yaml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,13 @@ runs:
3939
fi
4040
4141
- name: Get Compose
42-
env:
43-
COMPOSE_PATH: /usr/local/lib/docker/cli-plugins
44-
COMPOSE_VERSION: "v2.26.0"
45-
shell: bash
46-
run: |
47-
# Always remove `docker compose` support as that's the newer version
48-
# and comes installed by default nowadays.
49-
sudo rm -f "/usr/local/lib/docker/cli-plugins/docker-compose"
50-
# Docker Compose v1 is installed here, remove it
51-
sudo rm -f "/usr/local/bin/docker-compose"
52-
sudo rm -f "${{ env.COMPOSE_PATH }}/docker-compose"
53-
sudo mkdir -p "${{ env.COMPOSE_PATH }}"
54-
sudo curl -L https://github.com/docker/compose/releases/download/${{ env.COMPOSE_VERSION }}/docker-compose-`uname -s`-`uname -m` -o "${{ env.COMPOSE_PATH }}/docker-compose"
55-
sudo chmod +x "${{ env.COMPOSE_PATH }}/docker-compose"
42+
uses: ./get-compose-action
5643

5744
- name: Compute Docker Volume Cache Keys
5845
id: cache_key
5946
shell: bash
6047
run: |
61-
source ${{ github.action_path }}/.env
48+
source ${{ github.action_path }}.env
6249
# See https://explainshell.com/explain?cmd=ls%20-Rv1rpq
6350
# for that long `ls` command
6451
SENTRY_MIGRATIONS_MD5=$(docker run --rm --entrypoint bash $SENTRY_IMAGE -c '{ ls -Rv1rpq src/sentry/migrations/; sed -n "/KAFKA_TOPIC_TO_CLUSTER/,/}/p" src/sentry/conf/server.py; }' | md5sum | cut -d ' ' -f 1)

get-compose-action/action.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "Get Docker Compose"
2+
inputs:
3+
version:
4+
required: false
5+
default: 2.32.3
6+
description: "Docker Compose version"
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Get Compose
12+
shell: bash
13+
run: |
14+
# Docker Compose v1 is installed here, remove it
15+
sudo rm -f "/usr/local/bin/docker-compose"
16+
sudo rm -f "/usr/local/lib/docker/cli-plugins/docker-compose"
17+
sudo mkdir -p "/usr/local/lib/docker/cli-plugins"
18+
sudo curl -L https://github.com/docker/compose/releases/download/v${{ inputs.version }}/docker-compose-`uname -s`-`uname -m` -o "/usr/local/lib/docker/cli-plugins/docker-compose"
19+
sudo chmod +x "/usr/local/lib/docker/cli-plugins/docker-compose"

install/_min-requirements.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Don't forget to update the README and other docs when you change these!
22
MIN_DOCKER_VERSION='19.03.6'
3-
MIN_COMPOSE_VERSION='2.19.0'
3+
MIN_COMPOSE_VERSION='2.32.2'
44

55
# 16 GB minimum host RAM, but there'll be some overhead outside of what
66
# can be allotted to docker

install/dc-detect-version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ else
1616
dc="$dc_base --ansi never"
1717
fi
1818
proxy_args="--build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}"
19-
dcr="$dc run --rm"
19+
dcr="$dc run --pull=never --rm"
2020
dcb="$dc build $proxy_args"
2121
dbuild="docker build $proxy_args"
2222

sentry-admin.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on the host filesystem. Commands that write files should write them to the '/sen
2323
# Actual invocation that runs the command in the container.
2424
invocation() {
2525
$dc up postgres --wait
26-
$dcr --no-deps --quiet-pull -v "$VOLUME_MAPPING" -T -e SENTRY_LOG_LEVEL=CRITICAL web "$@" 2>&1
26+
$dcr --no-deps -v "$VOLUME_MAPPING" -T -e SENTRY_LOG_LEVEL=CRITICAL web "$@" 2>&1
2727
}
2828

2929
# Function to modify lines starting with `Usage: sentry` to say `Usage: ./sentry-admin.sh` instead.

0 commit comments

Comments
 (0)