Skip to content

Commit daf5646

Browse files
Merge branch 'main' into ssh-agent-on-pr987
2 parents 74d2bc9 + 09b226b commit daf5646

3 files changed

Lines changed: 27 additions & 35 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,16 @@ permissions:
88
on:
99
push:
1010
branches: [main]
11-
issue_comment:
12-
types: [created]
11+
pull_request:
12+
workflow_dispatch:
1313

1414
jobs:
1515
e2e:
1616
runs-on: ubuntu-latest
17-
# Run on push/PR or when a maintainer comments "/test e2e" or "/run e2e"
18-
if: |
19-
github.event_name != 'issue_comment' || (
20-
github.event.issue.pull_request &&
21-
(contains(github.event.comment.body, '/test e2e') || contains(github.event.comment.body, '/run e2e')) &&
22-
(github.event.comment.author_association == 'OWNER' ||
23-
github.event.comment.author_association == 'MEMBER' ||
24-
github.event.comment.author_association == 'COLLABORATOR')
25-
)
2617

2718
steps:
2819
- name: Checkout code
2920
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
30-
with:
31-
# When triggered by comment, checkout the PR branch
32-
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || github.ref }}
3321

3422
- name: Set up Docker Buildx
3523
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
@@ -57,8 +45,11 @@ jobs:
5745

5846
- name: Wait for services to be ready
5947
run: |
60-
timeout 60 bash -c 'until docker compose ps | grep -q "Up"; do sleep 2; done'
61-
sleep 10
48+
timeout 60 bash -c '
49+
while [ "$(docker compose ps | grep -c "Up")" -ne 3 ]; do
50+
sleep 2
51+
done
52+
' || { echo "Service readiness check failed:"; docker compose ps; exit 1; }
6253
6354
- name: Run E2E tests
6455
run: npm run test:e2e

Dockerfile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@ FROM node:20 AS builder
22

33
USER root
44

5-
WORKDIR /app
5+
WORKDIR /out
6+
7+
COPY package*.json ./
8+
COPY tsconfig.json tsconfig.publish.json proxy.config.json config.schema.json test-e2e.proxy.config.json vite.config.ts index.html index.ts ./
9+
10+
RUN npm pkg delete scripts.prepare && npm ci --include=dev
611

7-
COPY tsconfig.json tsconfig.publish.json proxy.config.json config.schema.json test-e2e.proxy.config.json vite.config.ts package*.json index.html index.ts ./
8-
COPY src/ /app/src/
9-
COPY public/ /app/public/
12+
COPY src/ /out/src/
13+
COPY public/ /out/public/
1014

11-
# Build the UI and server
12-
RUN npm pkg delete scripts.prepare \
13-
&& npm ci --include=dev \
14-
&& npm run build-ui -dd \
15+
RUN npm run build-ui \
1516
&& npx tsc --project tsconfig.publish.json \
1617
&& cp config.schema.json dist/ \
1718
&& npm prune --omit=dev
1819

1920
FROM node:20 AS production
2021

21-
COPY --from=builder /app/package*.json ./
22-
COPY --from=builder /app/node_modules/ /app/node_modules/
23-
COPY --from=builder /app/dist/ /app/dist/
24-
COPY --from=builder /app/build /app/dist/build/
22+
COPY --from=builder /out/package*.json ./
23+
COPY --from=builder /out/node_modules/ /app/node_modules/
24+
COPY --from=builder /out/dist/ /app/dist/
25+
COPY --from=builder /out/build /app/dist/build/
2526
COPY proxy.config.json config.schema.json ./
2627
COPY docker-entrypoint.sh /docker-entrypoint.sh
2728

@@ -31,8 +32,8 @@ RUN apt-get update && apt-get install -y \
3132
git tini \
3233
&& rm -rf /var/lib/apt/lists/*
3334

34-
RUN mkdir -p /app/.data /app/.tmp \
35-
&& chown 1000:1000 /app/dist/build /app/.data /app/.tmp
35+
RUN mkdir -p /app/.data /app/.tmp /app/.remote \
36+
&& chown -R 1000:1000 /app
3637

3738
USER 1000
3839

@@ -41,4 +42,4 @@ WORKDIR /app
4142
EXPOSE 8080 8000
4243

4344
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
44-
CMD ["node", "dist/index.js"]
45+
CMD ["node", "--enable-source-maps", "dist/index.js"]

src/proxy/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ export class Proxy {
5454
const defaultAuthorisedRepoList = getAuthorisedList();
5555
const allowedList: Repo[] = await getRepos();
5656

57-
defaultAuthorisedRepoList.forEach(async (x) => {
58-
const found = allowedList.find((y) => y.url === x.url);
57+
for (const defaultRepo of defaultAuthorisedRepoList) {
58+
const found = allowedList.find((configuredRepo) => configuredRepo.url === defaultRepo.url);
5959
if (!found) {
60-
const repo = await createRepo(x);
60+
const repo = await createRepo(defaultRepo);
6161
await addUserCanPush(repo._id!, 'admin');
6262
await addUserCanAuthorise(repo._id!, 'admin');
6363
}
64-
});
64+
}
6565
}
6666

6767
private async createApp() {

0 commit comments

Comments
 (0)