Skip to content

Commit 11c6316

Browse files
authored
Merge branch 'main-enterprise' into feat/github-action-mode-pr-comments
2 parents 136a55a + 254bad3 commit 11c6316

56 files changed

Lines changed: 9954 additions & 835 deletions

Some content is hidden

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

.devcontainer/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
1414
# [Optional] Uncomment if you want to install more global node modules
1515
# RUN su node -c "npm install -g <your-package-list-here>"
1616

17-
# Update npm
18-
RUN npm install -g npm
19-
# Intall aws cli
17+
# Install aws cli
2018
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
2119
unzip awscliv2.zip && \
2220
sudo ./aws/install && \

.github/workflows/create-pre-release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
with:
4949
node-version: 22.x
5050
cache: 'npm'
51-
- run: npm install
51+
- run: npm ci
5252
- name: Set up Docker Buildx
5353
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
5454
- name: Log in to the Container registry
@@ -58,7 +58,7 @@ jobs:
5858
username: ${{ github.actor }}
5959
password: ${{ secrets.GITHUB_TOKEN }}
6060
- name: Build Docker Image Locally
61-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
61+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294
6262
with:
6363
context: .
6464
file: ./Dockerfile
@@ -71,9 +71,10 @@ jobs:
7171
- name: Run Functional Tests
7272
id: functionaltest
7373
run: |
74-
docker run --env APP_ID=${{ secrets.APP_ID }} --env PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} --env WEBHOOK_SECRET=${{ secrets.WEBHOOK_SECRET }} -d -p 3000:3000 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-enterprise
74+
CONTAINER_ID=$(docker run --env APP_ID=${{ secrets.APP_ID }} --env PRIVATE_KEY=${{ secrets.PRIVATE_KEY }} --env WEBHOOK_SECRET=${{ secrets.WEBHOOK_SECRET }} --env NODE_ENV=development -d -p 3000:3000 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-enterprise)
7575
sleep 10
76-
curl http://localhost:3000
76+
docker logs $CONTAINER_ID || true
77+
curl --fail --retry 5 --retry-delay 3 --retry-connrefused http://localhost:3000
7778
- run: echo "${{ github.ref }}"
7879
- name: Tag a final release
7980
id: prerelease
@@ -85,7 +86,7 @@ jobs:
8586
commitish: ${{ github.ref }}
8687
- name: Push Docker Image
8788
if: ${{ success() }}
88-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
89+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294
8990
with:
9091
context: .
9192
file: ./Dockerfile

.github/workflows/create-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
with:
2727
node-version: 22.x
2828
cache: "npm"
29-
- run: npm install
29+
- run: npm ci
3030
- name: Set up Docker Buildx
3131
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
3232
- name: Log in to the Container registry
@@ -36,7 +36,7 @@ jobs:
3636
username: ${{ github.actor }}
3737
password: ${{ secrets.GITHUB_TOKEN }}
3838
- name: Build Docker Image Locally
39-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
39+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294
4040
with:
4141
context: .
4242
file: ./Dockerfile
@@ -59,7 +59,7 @@ jobs:
5959
bump: final
6060
- name: Push Docker Image
6161
if: ${{ success() }}
62-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
62+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294
6363
with:
6464
context: .
6565
file: ./Dockerfile

.github/workflows/node-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
node-version: ${{ matrix.node-version }}
2222
cache: npm
23-
- run: npm install
23+
- run: npm ci
2424
- run: npm run test:unit:ci
2525
strategy:
2626
matrix:

.github/workflows/rc-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
- name: Set up Docker Buildx
7777
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
7878
- name: Build and push Docker image
79-
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
79+
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294
8080
with:
8181
context: .
8282
push: true

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
FROM node:22-alpine
1+
FROM node:22-alpine@sha256:4d64b49e6c891c8fc821007cb1cdc6c0db7773110ac2c34bf2e6960adef62ed3
22
WORKDIR /opt/safe-settings
33
ENV NODE_ENV production
4+
ENV HOST=0.0.0.0
45
## Set the Labels
56
LABEL version="1.0" \
67
description="Probot app which is a modified version of Settings Probot GitHub App" \

app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ default_permissions:
115115
organization_administration: write
116116

117117
# Manage Actions variables.
118-
# https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28
118+
# https://docs.github.com/en/rest/actions/variables?apiVersion=2026-03-10
119119
actions_variables: write
120120

121121

docs/deploy.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ This will start the container in the background and detached.
8888
- `docker exec -it safe-settings /bin/sh`
8989
- You will now be inside the running **Docker** container and can perform any troubleshooting needed
9090

91+
### Troubleshooting Docker Build and Runtime Issues
92+
For detailed guidance on debugging Docker image builds, runtime failures, and comparing local vs. GHCR images, see [docker-debugging.md](docker-debugging.md).
93+
9194
## Deploy the app to AWS Lambda
9295

9396
### Production-Ready Template

docs/docker-debugging.md

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
2+
# Docker Build and Test Debugging Runbook
3+
4+
This document summarizes the Docker experiments done for this repo and converts them into a repeatable workflow for debugging local image builds and GHCR images.
5+
6+
## Goals
7+
8+
- Build and test the app image from local source.
9+
- Compare behavior with the published image from GHCR.
10+
- Quickly diagnose common failures (container startup, shell access, port exposure, env setup).
11+
12+
## What We Learned From The Experiments
13+
14+
- The image is Alpine-based, so use /bin/sh, not /bin/bash.
15+
- Use docker rm (or docker container rm) to remove containers. Commands like docker delete, docker destroy, or docker remove do not exist.
16+
- To pass host binding correctly, use HOST=0.0.0.0 (equal sign), not HOST:0.0.0.0.
17+
- Port mapping is required for host access: -p 3000:3000.
18+
- Supplying .env values is required for realistic startup testing.
19+
- Testing both local and GHCR images with the same runtime flags makes behavior comparisons easier.
20+
21+
## Prerequisites
22+
23+
- Docker is installed and running.
24+
- A valid .env file exists at repo root.
25+
- You are in repo root.
26+
27+
## 1) Build And Test Local Image
28+
29+
Build the local image:
30+
31+
```bash
32+
docker build -t safe-settings:local .
33+
```
34+
35+
Run container in foreground with explicit runtime env and port mapping:
36+
37+
```bash
38+
docker run --name safe-settings-local \
39+
--env-file ./.env \
40+
--env NODE_ENV=development \
41+
--env HOST=0.0.0.0 \
42+
-p 3000:3000 \
43+
-it safe-settings:local
44+
```
45+
46+
If startup fails, inspect logs:
47+
48+
```bash
49+
docker logs safe-settings-local
50+
```
51+
52+
Shell into running container for investigation:
53+
54+
```bash
55+
docker exec -it safe-settings-local /bin/sh
56+
```
57+
58+
Clean up:
59+
60+
```bash
61+
docker rm -f safe-settings-local
62+
```
63+
64+
## 2) Pull And Test GHCR Image
65+
66+
Pull published image:
67+
68+
```bash
69+
docker pull ghcr.io/github/safe-settings:2.1.19
70+
```
71+
72+
Run with the same env and port flags used for local testing:
73+
74+
```bash
75+
docker run --name safe-settings-ghcr \
76+
--env-file ./.env \
77+
--env NODE_ENV=development \
78+
--env HOST=0.0.0.0 \
79+
-p 3000:3000 \
80+
-it ghcr.io/github/safe-settings:2.1.19
81+
```
82+
83+
Inspect logs:
84+
85+
```bash
86+
docker logs safe-settings-ghcr
87+
```
88+
89+
Debug inside container:
90+
91+
```bash
92+
docker exec -it safe-settings-ghcr /bin/sh
93+
```
94+
95+
Clean up:
96+
97+
```bash
98+
docker rm -f safe-settings-ghcr
99+
```
100+
101+
## 3) Fast Differential Debug (Local vs GHCR)
102+
103+
Use this when one image works and the other does not.
104+
105+
1. Run both images with identical flags (env, HOST, port mapping).
106+
2. Compare startup logs side-by-side.
107+
3. Compare environment inside each container:
108+
109+
```bash
110+
docker exec -it safe-settings-local /bin/sh -c 'env | sort'
111+
docker exec -it safe-settings-ghcr /bin/sh -c 'env | sort'
112+
```
113+
114+
4. Confirm app process is listening on expected port inside container:
115+
116+
```bash
117+
docker exec -it safe-settings-local /bin/sh -c 'netstat -lntp 2>/dev/null || ss -lntp'
118+
docker exec -it safe-settings-ghcr /bin/sh -c 'netstat -lntp 2>/dev/null || ss -lntp'
119+
```
120+
121+
5. Validate host reachability:
122+
123+
```bash
124+
curl -i http://localhost:3000/
125+
```
126+
127+
## 4) Common Failure Patterns And Fixes
128+
129+
Symptom: container exits immediately.
130+
Likely causes:
131+
- Missing required variables in .env.
132+
- Invalid app credentials.
133+
Checks:
134+
- docker logs <container-name>
135+
- Confirm .env has required app settings.
136+
137+
Symptom: cannot connect from host to localhost:3000.
138+
Likely causes:
139+
- Missing -p 3000:3000.
140+
- App not binding to all interfaces.
141+
Checks:
142+
- Ensure HOST=0.0.0.0 is set.
143+
- Ensure port mapping is present.
144+
145+
Symptom: cannot shell into container with bash.
146+
Likely cause:
147+
- Alpine image does not include bash.
148+
Fix:
149+
- Use /bin/sh.
150+
151+
Symptom: name conflict when re-running tests.
152+
Likely cause:
153+
- Old container still exists.
154+
Fix:
155+
- docker rm -f <container-name>
156+
157+
## 5) Minimal Known-Good Commands
158+
159+
Local:
160+
161+
```bash
162+
docker build -t safe-settings:local . && \
163+
docker run --rm --name safe-settings-local \
164+
--env-file ./.env \
165+
--env NODE_ENV=development \
166+
--env HOST=0.0.0.0 \
167+
-p 3000:3000 \
168+
-it safe-settings:local
169+
```
170+
171+
GHCR:
172+
173+
```bash
174+
docker pull ghcr.io/github/safe-settings:2.1.19 && \
175+
docker run --rm --name safe-settings-ghcr \
176+
--env-file ./.env \
177+
--env NODE_ENV=development \
178+
--env HOST=0.0.0.0 \
179+
-p 3000:3000 \
180+
-it ghcr.io/github/safe-settings:2.1.19
181+
```

docs/github-settings/1. repository-settings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ repository:
5050
5151
>[!TIP]
5252
>GitHub's API documentation defines these inputs and types:
53-
>1. [Update an environment](https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#update-a-repository)
54-
>2. [Replace all repository topics](https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#replace-all-repository-topics)
53+
>1. [Update an environment](https://docs.github.com/en/rest/repos/repos?apiVersion=2026-03-10#update-a-repository)
54+
>2. [Replace all repository topics](https://docs.github.com/en/rest/repos/repos?apiVersion=2026-03-10#replace-all-repository-topics)
5555
5656
<table>
5757
<tr><td>

0 commit comments

Comments
 (0)