Skip to content

Commit 9052bc7

Browse files
committed
build: update project config
1 parent b34dcd9 commit 9052bc7

9 files changed

Lines changed: 81 additions & 81 deletions

File tree

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# Config/Serialisation
4040
.editorconfig text
4141
**/.editorconfig text
42+
*.graphql text
4243
*.ini text
4344
*.properties text
4445
*.json text
@@ -56,8 +57,11 @@
5657
*.fish text eol=lf
5758
*.sh text eol=lf
5859
*.zsh text eol=lf
60+
*.dart text
61+
*.hx text
5962
*.lua text
6063
*.php text
64+
*.py text
6165
*.python text
6266
*.sql text
6367
**/Dockerfile text eol=lf
@@ -125,6 +129,8 @@
125129
*.htm text diff=html
126130
*.html text diff=html
127131
*.js text
132+
*.ts text
133+
*.vue text
128134

129135

130136
# https://git-scm.com/docs/gitattributes#_export_ignore

.github/workflows/build.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
# SPDX-License-Identifier: Apache-2.0
44
# SPDX-ArtifactOfProjectHomePage: https://github.com/vegardit/docker-softhsm2-pkcs11-proxy
55
#
6-
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions
6+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
77
name: Build
88

9-
on:
9+
on: # https://docs.github.com/en/actions/reference/events-that-trigger-workflows
10+
schedule:
11+
# https://docs.github.com/en/actions/reference/choosing-when-your-workflow-runs/events-that-trigger-workflows
12+
- cron: '0 17 * * 3'
1013
push:
1114
branches-ignore: # build all branches except:
1215
- 'dependabot/**' # prevent GHA triggered twice (once for commit to the branch and once for opening/syncing the PR)
@@ -25,20 +28,20 @@ on:
2528
- '.git*'
2629
- '.github/*.yml'
2730
- '.github/workflows/stale.yml'
28-
schedule:
29-
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
30-
- cron: '0 17 * * 3'
3131
workflow_dispatch:
32-
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_dispatch
32+
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
33+
3334

3435
defaults:
3536
run:
3637
shell: bash
3738

39+
3840
env:
3941
DOCKER_REPO_NAME: softhsm2-pkcs11-proxy
4042
TRIVY_CACHE_DIR: ~/.trivy/cache
4143

44+
4245
jobs:
4346

4447
###########################################################
@@ -59,7 +62,7 @@ jobs:
5962
- name: "Show: GitHub context"
6063
env:
6164
GITHUB_CONTEXT: ${{ toJSON(github) }}
62-
run: echo $GITHUB_CONTEXT
65+
run: printf '%s' "$GITHUB_CONTEXT" | python -m json.tool
6366

6467

6568
- name: "Show: environment variables"
@@ -167,7 +170,7 @@ jobs:
167170
concurrency:
168171
group: ${{ github.workflow }}
169172
cancel-in-progress: false
170-
173+
171174
permissions:
172175
packages: write
173176

.github/workflows/stale.yml

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions
1+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
22
name: Stale issues
33

44
on:
55
schedule:
6-
- cron: '0 16 * * 1'
6+
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows
7+
- cron: '0 15 1,15 * *'
78
workflow_dispatch:
8-
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
9+
# https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch
910

1011
permissions:
1112
issues: write
@@ -14,43 +15,6 @@ permissions:
1415
jobs:
1516
stale:
1617
runs-on: ubuntu-latest
17-
1818
steps:
19-
- name: Git checkout
20-
uses: actions/checkout@v5 # https://github.com/actions/checkout
21-
22-
- name: Run stale action
23-
uses: actions/stale@v10 # https://github.com/actions/stale
24-
with:
25-
repo-token: ${{ secrets.GITHUB_TOKEN }}
26-
days-before-stale: 90
27-
days-before-close: 14
28-
stale-issue-message: >
29-
This issue has been automatically marked as stale because it has not had
30-
recent activity. It will be closed in 14 days if no further activity occurs.
31-
If the issue is still valid, please add a respective comment to prevent this
32-
issue from being closed automatically. Thank you for your contributions.
33-
stale-issue-label: stale
34-
close-issue-label: wontfix
35-
exempt-issue-labels: |
36-
enhancement
37-
pinned
38-
security
39-
40-
- name: Run stale action (for enhancements)
41-
uses: actions/stale@v10 # https://github.com/actions/stale
42-
with:
43-
repo-token: ${{ secrets.GITHUB_TOKEN }}
44-
days-before-stale: 360
45-
days-before-close: 14
46-
stale-issue-message: >
47-
This issue has been automatically marked as stale because it has not had
48-
recent activity. It will be closed in 14 days if no further activity occurs.
49-
If the issue is still valid, please add a respective comment to prevent this
50-
issue from being closed automatically. Thank you for your contributions.
51-
stale-issue-label: stale
52-
close-issue-label: wontfix
53-
only-labels: enhancement
54-
exempt-issue-labels: |
55-
pinned
56-
security
19+
- name: Run stale action
20+
uses: sebthom/gha-shared/.github/actions/stale@v1

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ _LOCAL/
1111
.project
1212
.settings/
1313
bin/
14-
**/.*.md.html
1514

1615
# IntelliJ
1716
/.idea

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ representative at an online or offline event.
6060

6161
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6262
reported to the community leaders responsible for enforcement at
63-
https://vegardit.com/en/legal/.
63+
https://vegardit.com/en/legal/
6464
All complaints will be reviewed and investigated promptly and fairly.
6565

6666
All community leaders are obligated to respect the privacy and security of the

CONTRIBUTING.md

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,45 @@
1-
# Contributing
1+
# Contributing to the Project
22

3-
Thanks for your interest in contributing to this project!
3+
Thank you for your interest in contributing to this project! We strive to make the contribution process clear and welcoming.
44

5-
We want to make contributing as easy and transparent as possible.
5+
Please take a moment to review the guidelines below.
66

77

88
## Code of Conduct
99

10-
Our code of conduct is described in [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
10+
Please review and adhere to our [Code of Conduct](CODE_OF_CONDUCT.md) in all your interactions with the project.
11+
This helps us maintain a positive and respectful environment for everyone involved.
1112

1213

13-
## Issues
14+
## How to Contribute
1415

15-
We use GitHub issues to track bugs and feature requests. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue.
16+
### Contributor Responsibilities
1617

18+
By submitting your contributions, you agree to the following:
19+
- You are the sole author of the content you contribute, or you have the appropriate rights and permissions to contribute it.
20+
- If employed, you have obtained any necessary permissions from your employer to contribute to this project.
21+
- All contributions will be made available under the project’s license.
1722

18-
## Pull Requests
23+
### Issues
1924

20-
Before you make a substantial pull request, please file an issue and make sure someone from the team agrees that there is a problem or room for improvement.
25+
We use GitHub Issues to track bugs and feature requests. When submitting an issue, please ensure:
26+
- The description is clear and concise.
27+
- You provide enough details and steps to reproduce the issue, if applicable.
2128

29+
### Pull Requests
2230

23-
## License
31+
Before making substantial contributions:
32+
1. **Discuss Changes**: Please file an issue first to discuss your proposed changes with the team. This helps ensure your contribution aligns with the project’s goals.
33+
2. **Follow Best Practices**: Adhere to the guidelines and ensure your code meets the project’s standards (see [Code Guidelines](#code-guidelines)).
2434

25-
By contributing your code, you agree to license your contribution under the [Apache License 2.0](LICENSE.txt).
35+
When submitting a pull request:
36+
- Ensure your changes are well-documented.
37+
- Include tests for any new features or significant changes.
38+
- Reference the relevant issue(s) in your pull request description.
39+
40+
41+
## Licensing
42+
43+
By contributing to this project, you agree that your contributions will be licensed under the [Apache License 2.0](LICENSE.txt).
44+
45+
The project itself is also licensed under the [Apache License 2.0](LICENSE.txt)).

build-image.sh

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,15 @@ echo "
106106
" | sudo tee /etc/buildkitd.toml
107107

108108
builder_name="bx-$(date +%s)-$RANDOM"
109-
run_step "Configure buildx builder" -- docker buildx create \
109+
run_step "buildx builder: configure" -- docker buildx create \
110110
--name "$builder_name" \
111111
--bootstrap \
112112
--config /etc/buildkitd.toml \
113113
--driver-opt network=host `# required for buildx to access the temporary registry` \
114114
--driver docker-container \
115115
--driver-opt image=ghcr.io/dockerhub-mirror/moby__buildkit:latest
116-
trap 'docker buildx rm --force "$builder_name"' EXIT
116+
add_trap "docker buildx rm --force '$builder_name'" EXIT
117+
run_step "buildx builder: inspect" -- docker buildx inspect "$builder_name" --bootstrap
117118

118119

119120
#################################################
@@ -152,10 +153,9 @@ for key in "${!image_meta[@]}"; do
152153
done
153154

154155
if [[ ${build_multi_arch:-} == "true" ]]; then
155-
build_opts+=(--push)
156-
build_opts+=(--sbom=true) # https://docs.docker.com/build/metadata/attestations/sbom/#create-sbom-attestations
157156
build_opts+=(--platform "$platforms")
158-
build_opts+=(--tag "$LOCAL_REGISTRY/$image_name")
157+
build_opts+=(--sbom=true) # https://docs.docker.com/build/metadata/attestations/sbom/#create-sbom-attestations
158+
build_opts+=(--output "type=registry,name=${LOCAL_REGISTRY}/${image_name},registry.http=true,registry.insecure=true")
159159
else
160160
build_opts+=(--output "type=docker,load=true")
161161
build_opts+=(--tag "$image_name")
@@ -173,10 +173,16 @@ run_step "Building docker image [$image_name]..." -- \
173173
# load image into local docker daemon for testing
174174
#################################################
175175
if [[ ${build_multi_arch:-} == "true" ]]; then
176-
run_step "Load image into local daemon for testing" @@ "
177-
docker pull '$LOCAL_REGISTRY/$image_name';
178-
docker tag '$LOCAL_REGISTRY/$image_name' '$image_name'
179-
"
176+
# cannot use "regctl image copy ... " which does not support loading into docker daemon https://github.com/regclient/regclient/issues/568
177+
# cannot use "docker pull '$LOCAL_REGISTRY/$image_name'" which does not support ad-hoc pulling from unsecure registries - must be allowed in docker daemon config
178+
run_step "Load image into local daemon for testing" -- \
179+
docker run --rm \
180+
-v /var/run/docker.sock:/var/run/docker.sock \
181+
--network host `# required to access the temporary registry` \
182+
quay.io/skopeo/stable:latest \
183+
copy --src-tls-verify=false \
184+
"docker://$LOCAL_REGISTRY/$image_name" \
185+
"docker-daemon:$image_name"
180186
fi
181187

182188

@@ -185,7 +191,7 @@ fi
185191
#################################################
186192
if [[ ${DOCKER_AUDIT_IMAGE:-1} == "1" ]]; then
187193
run_step "Auditing docker image [$image_name]" -- \
188-
bash "$shared_lib/cmd/audit-image.sh" "$image_name"
194+
bash "$shared_lib/cmd/audit-image.sh" "$image_name"
189195
fi
190196

191197

@@ -207,16 +213,18 @@ function regctl() {
207213
--network host `# required to access the temporary registry` \
208214
ghcr.io/regclient/regctl:latest \
209215
--host "reg=$LOCAL_REGISTRY,tls=disabled" \
216+
--verbosity debug \
210217
"${@}"
211218
}
212219

213220
if [[ ${DOCKER_PUSH:-} == "true" ]]; then
214221
for tag in "${tags[@]}"; do
215-
regctl image copy --referrers "$LOCAL_REGISTRY/$image_name" "docker.io/$image_repo:$tag"
222+
# cannot use "skopeo copy ... " which does not support SBOMs https://github.com/containers/skopeo/issues/2393
223+
regctl image copy --digest-tags --include-external --referrers "$LOCAL_REGISTRY/$image_name" "docker.io/$image_repo:$tag"
216224
done
217225
fi
218226
if [[ ${DOCKER_PUSH_GHCR:-} == "true" ]]; then
219227
for tag in "${tags[@]}"; do
220-
regctl image copy --referrers "$LOCAL_REGISTRY/$image_name" "ghcr.io/$image_repo:$tag"
228+
regctl image copy --digest-tags --include-external --referrers "$LOCAL_REGISTRY/$image_name" "ghcr.io/$image_repo:$tag"
221229
done
222230
fi

image/debian.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ARG PKCS11_PROXY_SOURCE_URL
2828

2929
ARG BASE_LAYER_CACHE_KEY
3030

31-
# https://github.com/hadolint/hadolint/wiki/DL3008 Pin versions
31+
# https://github.com/hadolint/hadolint/wiki/DL3008 Pin versions in apt-get
3232
# hadolint ignore=DL3008
3333
RUN --mount=type=bind,source=.shared,target=/mnt/shared <<EOF
3434
/mnt/shared/cmd/debian-install-os-updates.sh

image/run.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ awk '/32 host/ { if(uniq[ip]++ && ip != "127.0.0.1") print " - " ip } {ip=$2}' /
2828

2929
log INFO "Configuring SoftHSM storage type [$SOFTHSM_STORAGE]..."
3030
case $SOFTHSM_STORAGE in
31-
file) sed -iE 's/^objectstore.backend\s?=\s?.*/objectstore.backend = file/' /etc/softhsm2.conf ;;
32-
db|sqlite) sed -iE 's/^objectstore.backend\s?=\s?.*/objectstore.backend = db/' /etc/softhsm2.conf ;;
33-
*) log ERROR "Unsupported SoftHSM storage type [$SOFTHSM_STORAGE]"; exit 1 ;;
31+
file) sed -iE 's/^objectstore.backend\s?=\s?.*/objectstore.backend = file/' /etc/softhsm2.conf ;;
32+
db|sqlite) sed -iE 's/^objectstore.backend\s?=\s?.*/objectstore.backend = db/' /etc/softhsm2.conf ;;
33+
*) log ERROR "Unsupported SoftHSM storage type [$SOFTHSM_STORAGE]"; exit 1 ;;
3434
esac
3535

3636

3737
#################################################
3838
# load custom init script if specified
3939
#################################################
4040
if [[ -f $INIT_SH_FILE ]]; then
41-
log INFO "Loading [$INIT_SH_FILE]..."
42-
# shellcheck disable=SC1090 # ShellCheck can't follow non-constant source
43-
source "$INIT_SH_FILE"
41+
log INFO "Loading [$INIT_SH_FILE]..."
42+
# shellcheck disable=SC1090 # ShellCheck can't follow non-constant source
43+
source "$INIT_SH_FILE"
4444
fi
4545

4646
log INFO "Starting pkcs11-daemon..."

0 commit comments

Comments
 (0)