Skip to content

Commit 1702399

Browse files
committed
Merge branch 'bugfix/CLDSRV-732-nyc-flakiness' into q/9.0
2 parents 9540788 + 0323321 commit 1702399

File tree

5 files changed

+61
-26
lines changed

5 files changed

+61
-26
lines changed

.github/docker/docker-compose.yaml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,6 @@
11
services:
22
cloudserver:
33
image: ${CLOUDSERVER_IMAGE}
4-
command: |
5-
bash -c "
6-
# Using tini to handle signals properly
7-
tini -s -g -- npx nyc --clean --silent yarn start > /artifacts/s3.log 2> /artifacts/s3-stderr.log &
8-
PID=$$!
9-
generate_coverage() {
10-
echo 'Stopping NodeJS processes...'
11-
kill -TERM $$PID 2>/dev/null || true
12-
wait $$PID
13-
echo 'Generating coverage report...'
14-
npx nyc report --report-dir /coverage/test --reporter=lcov --reporter=text-summary
15-
}
16-
trap generate_coverage SIGTERM
17-
wait $$PID
18-
"
194
network_mode: "host"
205
volumes:
216
- /tmp/ssl:/ssl

.github/workflows/release.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,21 @@ jobs:
4848
with:
4949
context: .
5050
push: true
51+
target: production
5152
tags: ghcr.io/${{ github.repository }}:${{ github.event.inputs.tag }}
5253
cache-from: type=gha
5354
cache-to: type=gha,mode=max
5455

56+
- name: Build and push test coverage image
57+
uses: docker/build-push-action@v5
58+
with:
59+
context: .
60+
push: true
61+
target: testcoverage
62+
tags: ghcr.io/${{ github.repository }}:${{ github.event.inputs.tag }}-testcoverage
63+
cache-from: type=gha
64+
cache-to: type=gha,mode=max
65+
5566
- name: Build and push federation image
5667
uses: docker/build-push-action@v5
5768
with:

.github/workflows/tests.yaml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ jobs:
178178
with:
179179
push: true
180180
context: .
181+
target: production
181182
provenance: false
182183
tags: |
183184
ghcr.io/${{ github.repository }}:${{ github.sha }}
@@ -187,6 +188,21 @@ jobs:
187188
cache-from: type=gha,scope=cloudserver
188189
cache-to: type=gha,mode=max,scope=cloudserver
189190

191+
- name: Build and push cloudserver image test coverage
192+
uses: docker/build-push-action@v5
193+
with:
194+
push: true
195+
context: .
196+
target: testcoverage
197+
provenance: false
198+
tags: |
199+
ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
200+
labels: |
201+
git.repository=${{ github.repository }}
202+
git.commit-sha=${{ github.sha }}
203+
cache-from: type=gha,scope=cloudserver
204+
cache-to: type=gha,mode=max,scope=cloudserver
205+
190206
- name: Build and push federation image
191207
uses: docker/build-push-action@v5
192208
with:
@@ -229,7 +245,7 @@ jobs:
229245
runs-on: ubuntu-24.04
230246
needs: build
231247
env:
232-
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
248+
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
233249
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
234250
S3BACKEND: mem
235251
S3_LOCATION_FILE: /usr/src/app/tests/locationConfig/locationConfigTests.json
@@ -295,7 +311,7 @@ jobs:
295311
S3_LOCATION_FILE: /usr/src/app/tests/locationConfig/locationConfigTests.json
296312
DEFAULT_BUCKET_KEY_FORMAT: v0
297313
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
298-
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
314+
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
299315
JOB_NAME: ${{ github.job }}
300316
steps:
301317
- name: Checkout
@@ -348,7 +364,7 @@ jobs:
348364
DEFAULT_BUCKET_KEY_FORMAT: v1
349365
METADATA_MAX_CACHED_BUCKETS: 1
350366
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
351-
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
367+
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
352368
JOB_NAME: ${{ github.job }}
353369
steps:
354370
- name: Checkout
@@ -405,7 +421,7 @@ jobs:
405421
env:
406422
S3BACKEND: file
407423
S3VAULT: mem
408-
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
424+
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
409425
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
410426
MPU_TESTING: "yes"
411427
ENABLE_NULL_VERSION_COMPAT_MODE: "${{ matrix.enable-null-compat }}"
@@ -575,7 +591,7 @@ jobs:
575591
ENABLE_UTAPI_V2: t
576592
S3BACKEND: mem
577593
BUCKET_DENY_FILTER: utapi-event-filter-deny-bucket
578-
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
594+
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
579595
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
580596
JOB_NAME: ${{ github.job }}
581597
steps:
@@ -631,7 +647,7 @@ jobs:
631647
SCUBA_HOST: localhost
632648
SCUBA_PORT: 8100
633649
SCUBA_HEALTHCHECK_FREQUENCY: 100
634-
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
650+
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
635651
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
636652
JOB_NAME: ${{ github.job }}
637653
steps:
@@ -678,7 +694,7 @@ jobs:
678694
S3BACKEND: file
679695
S3VAULT: mem
680696
MPU_TESTING: "yes"
681-
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
697+
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
682698
PYKMIP_IMAGE: ghcr.io/${{ github.repository }}/pykmip:${{ github.sha }}
683699
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
684700
JOB_NAME: ${{ github.job }}
@@ -738,7 +754,7 @@ jobs:
738754
S3BACKEND: file
739755
S3VAULT: mem
740756
MPU_TESTING: true
741-
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
757+
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
742758
PYKMIP_IMAGE: ghcr.io/${{ github.repository }}/pykmip:${{ github.sha }}
743759
JOB_NAME: ${{ github.job }}
744760
COMPOSE_FILE: docker-compose.yaml:docker-compose.sse.yaml
@@ -804,7 +820,7 @@ jobs:
804820
MPU_TESTING: "yes"
805821
S3_LOCATION_FILE: /usr/src/app/tests/locationConfig/locationConfigCeph.json
806822
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
807-
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
823+
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
808824
JOB_NAME: ${{ github.job }}
809825
ENABLE_NULL_VERSION_COMPAT_MODE: true # needed with mongodb backend
810826
steps:
@@ -925,7 +941,7 @@ jobs:
925941
VAULT_VERSION_CURRENT: 7.70.32
926942
CLOUDSERVER_IMAGE_BEFORE_SSE_MIGRATION: ghcr.io/${{ github.repository }}:9.0.8
927943
VAULT_IMAGE_BEFORE_SSE_MIGRATION: ghcr.io/scality/vault:7.70.31
928-
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
944+
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}-testcoverage
929945
VAULT_IMAGE: ghcr.io/scality/vault:7.70.32
930946
KMS_IMAGE: nsmithuk/local-kms:3.11.7
931947
MPU_TESTING: "yes"

Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ COPY package.json yarn.lock /usr/src/app/
3030
RUN yarn install --production --ignore-optional --frozen-lockfile --ignore-engines --network-concurrency 1
3131

3232
################################################################################
33-
FROM node:${NODE_VERSION}
33+
FROM node:${NODE_VERSION} AS production
3434

3535
ENV NO_PROXY=localhost,127.0.0.1
3636
ENV no_proxy=localhost,127.0.0.1
@@ -55,3 +55,10 @@ VOLUME ["/usr/src/app/localData","/usr/src/app/localMetadata"]
5555
ENTRYPOINT ["tini", "-g", "--", "/usr/src/app/docker-entrypoint.sh"]
5656

5757
CMD [ "yarn", "start" ]
58+
59+
################################################################################
60+
FROM production AS testcoverage
61+
62+
RUN yarn global add nyc
63+
64+
CMD [ "./docker-test-with-coverage.sh" ]

docker-test-with-coverage.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
nyc --clean --silent yarn start > /artifacts/s3.log 2> /artifacts/s3-stderr.log &
4+
5+
PID=$!
6+
7+
generate_coverage() {
8+
echo 'Stopping NodeJS processes...'
9+
kill -TERM $PID 2>/dev/null || true
10+
wait $PID
11+
echo 'Generating coverage report...'
12+
nyc report --report-dir /coverage/test --reporter=lcov --reporter=text-summary
13+
}
14+
15+
trap generate_coverage SIGTERM
16+
wait $PID

0 commit comments

Comments
 (0)