Skip to content

Commit 4884908

Browse files
committed
CI Improvements for testing images
* Drop forced chown during copy * Adding PR Template
1 parent 8aa95c1 commit 4884908

File tree

3 files changed

+145
-10
lines changed

3 files changed

+145
-10
lines changed

.github/pull_request_template.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
## Description
2+
<!-- Describe your changes in detail -->
3+
4+
## Type of Change
5+
<!-- Mark the relevant option with an 'x' -->
6+
7+
- [ ] Bug fix (non-breaking change which fixes an issue)
8+
- [ ] New feature (non-breaking change which adds functionality)
9+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10+
- [ ] Documentation update
11+
- [ ] Dependency update
12+
13+
## Related Issues
14+
<!-- Link to related issues, e.g., "Fixes #123" or "Relates to #456" -->
15+
16+
## Testing
17+
<!-- Describe how you tested your changes -->
18+
19+
### Test Environment
20+
- [ ] Docker
21+
- [ ] Podman (rootless)
22+
- [ ] Docker Compose
23+
- [ ] Other: ___________
24+
25+
### Platforms Tested
26+
- [ ] linux/amd64
27+
- [ ] linux/arm64
28+
29+
### Test Scenarios
30+
- [ ] Standard volume mount
31+
- [ ] NFS volume mount
32+
- [ ] Custom PUID/PGID
33+
- [ ] SELinux enabled
34+
- [ ] Other: ___________
35+
36+
### Test Results
37+
```
38+
# Paste relevant test output or logs
39+
```
40+
41+
## Test Images
42+
<!-- Automated test images will be built and commented on this PR -->
43+
Once the build completes, test images will be available:
44+
- `netbootxyz/netbootxyz:pr-{number}`
45+
- `ghcr.io/netbootxyz/netbootxyz:pr-{number}`
46+
47+
See the auto-generated comment below for pull and test commands.
48+
49+
## Checklist
50+
- [ ] My code follows the style of this project
51+
- [ ] I have tested my changes locally
52+
- [ ] I have tested the automated PR build image
53+
- [ ] I have updated documentation (if applicable)
54+
- [ ] My changes generate no new errors or warnings
55+
- [ ] I have added comments to complex code sections
56+
57+
## Additional Notes
58+
<!-- Any additional information that reviewers should know -->

.github/workflows/build.yml

Lines changed: 85 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
branches:
55
- master
66
workflow_dispatch:
7+
inputs:
8+
tag_suffix:
9+
description: 'Optional tag suffix (e.g., "test-feature")'
10+
required: false
11+
default: ''
712

813
jobs:
914
build:
@@ -39,6 +44,21 @@ jobs:
3944
WEBAPP_RELEASE=$(curl -sX GET "https://api.github.com/repos/netbootxyz/webapp/releases/latest" | jq -r '. | .tag_name')
4045
echo "WEBAPP_RELEASE=${WEBAPP_RELEASE}" >> $GITHUB_ENV
4146
47+
- name: Determine tag strategy
48+
id: tags
49+
run: |
50+
if [ "${{ github.event_name }}" == "pull_request" ]; then
51+
echo "TAG_SUFFIX=pr-${{ github.event.number }}" >> $GITHUB_ENV
52+
echo "IS_PR=true" >> $GITHUB_ENV
53+
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
54+
if [ -n "${{ github.event.inputs.tag_suffix }}" ]; then
55+
echo "TAG_SUFFIX=test-${{ github.event.inputs.tag_suffix }}" >> $GITHUB_ENV
56+
else
57+
echo "TAG_SUFFIX=test-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_ENV
58+
fi
59+
echo "IS_PR=false" >> $GITHUB_ENV
60+
fi
61+
4262
- name: Build and push PR test image
4363
uses: docker/build-push-action@v6
4464
with:
@@ -48,26 +68,82 @@ jobs:
4868
platforms: linux/amd64,linux/arm64
4969
build-args: |
5070
WEBAPP_VERSION=${{ env.WEBAPP_RELEASE }}
51-
VERSION=pr-${{ github.event.number }}
71+
VERSION=${{ env.TAG_SUFFIX }}
5272
BUILD_DATE=$(date +'%Y-%m-%dT%H:%M:%S')
5373
tags: |
54-
netbootxyz/netbootxyz:pr-${{ github.event.number }}
55-
netbootxyz/netbootxyz:pr-${{ github.event.number }}-${{ github.sha }}
56-
ghcr.io/netbootxyz/netbootxyz:pr-${{ github.event.number }}
57-
ghcr.io/netbootxyz/netbootxyz:pr-${{ github.event.number }}-${{ github.sha }}
74+
netbootxyz/netbootxyz:${{ env.TAG_SUFFIX }}
75+
netbootxyz/netbootxyz:${{ env.TAG_SUFFIX }}-${{ github.sha }}
76+
ghcr.io/netbootxyz/netbootxyz:${{ env.TAG_SUFFIX }}
77+
ghcr.io/netbootxyz/netbootxyz:${{ env.TAG_SUFFIX }}-${{ github.sha }}
5878
labels: |
5979
org.opencontainers.image.title=netbootxyz
60-
org.opencontainers.image.description=netboot.xyz PR test image
61-
org.opencontainers.image.version=pr-${{ github.event.number }}
80+
org.opencontainers.image.description=netboot.xyz test image
81+
org.opencontainers.image.version=${{ env.TAG_SUFFIX }}
6282
org.opencontainers.image.revision=${{ github.sha }}
6383
org.opencontainers.image.source=https://github.com/netbootxyz/docker-netbootxyz
6484
6585
- name: Run Trivy vulnerability scanner
6686
uses: aquasecurity/trivy-action@0.33.1
6787
with:
68-
image-ref: 'ghcr.io/netbootxyz/netbootxyz:pr-${{ github.event.number }}'
88+
image-ref: 'ghcr.io/netbootxyz/netbootxyz:${{ env.TAG_SUFFIX }}'
6989
format: 'table'
70-
exit-code: '1'
90+
exit-code: '0'
7191
ignore-unfixed: true
7292
vuln-type: 'os,library'
7393
severity: 'CRITICAL,HIGH'
94+
95+
- name: Comment on PR with test instructions
96+
if: github.event_name == 'pull_request'
97+
uses: actions/github-script@v7
98+
with:
99+
script: |
100+
const comment = `## 🚀 Test Image Built Successfully!
101+
102+
Your PR test images have been published and are ready for testing:
103+
104+
### Docker Hub
105+
\`\`\`bash
106+
docker pull netbootxyz/netbootxyz:pr-${{ github.event.number }}
107+
\`\`\`
108+
109+
### GitHub Container Registry
110+
\`\`\`bash
111+
docker pull ghcr.io/netbootxyz/netbootxyz:pr-${{ github.event.number }}
112+
\`\`\`
113+
114+
### Quick Test Commands
115+
116+
**Standard Docker:**
117+
\`\`\`bash
118+
docker run -d \\
119+
--name netbootxyz-test \\
120+
-e PUID=1000 \\
121+
-e PGID=1000 \\
122+
-p 3000:3000 \\
123+
-p 69:69/udp \\
124+
-p 8080:80 \\
125+
-v /local/path/config:/config \\
126+
netbootxyz/netbootxyz:pr-${{ github.event.number }}
127+
\`\`\`
128+
129+
### Platforms
130+
- ✅ linux/amd64
131+
- ✅ linux/arm64
132+
133+
### Check Logs
134+
\`\`\`bash
135+
docker logs -f netbootxyz-test
136+
\`\`\`
137+
138+
---
139+
📦 **SHA:** \`${{ github.sha }}\`
140+
🏷️ **Webapp Version:** \`${{ env.WEBAPP_RELEASE }}\`
141+
`;
142+
143+
github.rest.issues.createComment({
144+
issue_number: context.issue.number,
145+
owner: context.repo.owner,
146+
repo: context.repo.repo,
147+
body: comment
148+
});
149+

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ LABEL org.opencontainers.image.title="netboot.xyz" \
5050
maintainer="antonym"
5151

5252
# Install runtime dependencies and configure system in a single layer
53+
RUN apk --initdb add --no-cache alpine-baselayout busybox
5354
RUN apk add --no-cache \
5455
# Core utilities
5556
bash \
@@ -91,7 +92,7 @@ EXPOSE 80
9192
EXPOSE 3000
9293

9394
# Copy configuration files and scripts
94-
COPY --chown=root:root root/ /
95+
COPY root/ /
9596

9697
# Make scripts executable
9798
RUN chmod +x /start.sh /init.sh /healthcheck.sh /usr/local/bin/dnsmasq-wrapper.sh

0 commit comments

Comments
 (0)