Skip to content

Commit f9c163c

Browse files
authored
Merge pull request #282 from Security-Tools-Alliance/release/2.2.0
Release/2.2.0
2 parents 4482709 + 88c1c0e commit f9c163c

File tree

177 files changed

+90941
-18259
lines changed

Some content is hidden

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

177 files changed

+90941
-18259
lines changed

.env-dist

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,16 @@ INSTALL_TYPE=prebuilt
4343
DJANGO_SUPERUSER_USERNAME=rengine
4444
DJANGO_SUPERUSER_EMAIL=rengine@example.com
4545
DJANGO_SUPERUSER_PASSWORD=Sm7IJG.IfHAFw9snSKv
46+
47+
#
48+
# GPU Configuration for Ollama LLM
49+
# Set GPU=1 to enable GPU support (default: 0 for CPU only)
50+
# GPU_TYPE will be automatically set during installation (nvidia or rocm)
51+
# DOCKER_RUNTIME will match GPU_TYPE when GPU support is enabled
52+
#
53+
GPU=0
54+
GPU_TYPE=none
55+
DOCKER_RUNTIME=none
56+
57+
# Ollama Configuration
58+
#OLLAMA_INSTANCE=http://ollama:11434

.github/workflows/build.yml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,34 @@ env:
3232

3333
jobs:
3434
build-and-push:
35-
runs-on: ubuntu-latest
35+
runs-on: ubuntu-22.04
3636
strategy:
3737
matrix:
3838
image: [celery, web, postgres, redis, ollama, certs, proxy]
39-
platform: [linux/amd64, linux/arm64]
4039
steps:
4140
- name: Checkout code
4241
uses: actions/checkout@v4
4342

4443
- name: Get version
4544
id: get_version
4645
run: |
47-
if [[ $GITHUB_REF == refs/tags/* ]]; then
48-
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
49-
else
50-
echo "VERSION=latest" >> $GITHUB_OUTPUT
51-
fi
46+
VERSION=$(cat web/reNgine/version.txt)
47+
echo "version=$VERSION" >> $GITHUB_OUTPUT
48+
49+
- name: Docker meta
50+
id: meta
51+
uses: docker/metadata-action@v5
52+
with:
53+
images: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.PROJECT }}
54+
tags: |
55+
type=ref,event=branch,enable=${{ !contains(github.ref, 'release/') }}
56+
type=ref,event=pr
57+
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v') }}
58+
type=raw,value=v${{ steps.get_version.outputs.version }},enable=${{ contains(github.ref, 'release/') }}
59+
type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v') }}
60+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
61+
flavor: |
62+
prefix=rengine-${{ matrix.image }}-,onlatest=true
5263
5364
- name: Set up QEMU
5465
uses: docker/setup-qemu-action@v3
@@ -70,15 +81,17 @@ jobs:
7081
context: ./docker/${{ matrix.image }}
7182
file: ./docker/${{ matrix.image }}/Dockerfile
7283
push: ${{ github.event_name != 'pull_request' || github.event.inputs.push_image == 'true' }}
73-
tags: |
74-
${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.PROJECT }}:rengine-${{ matrix.image }}-${{ steps.get_version.outputs.VERSION }}
75-
${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.PROJECT }}:rengine-${{ matrix.image }}-latest
76-
platforms: ${{ matrix.platform }}
84+
build-args: |
85+
HOST_UID=1000
86+
HOST_GID=1000
87+
tags: ${{ steps.meta.outputs.tags }}
88+
labels: ${{ steps.meta.outputs.labels }}
89+
platforms: linux/amd64,linux/arm64
7790

7891
update-release:
7992
needs: build-and-push
8093
if: github.event_name == 'release' && github.event.action == 'published'
81-
runs-on: ubuntu-latest
94+
runs-on: ubuntu-22.04
8295
steps:
8396
- name: Checkout code
8497
uses: actions/checkout@v4

.github/workflows/close-issues-on-pr-merge-to-release-branch.yml

Lines changed: 143 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,151 @@ on:
77

88
jobs:
99
close-related-issues:
10-
runs-on: ubuntu-latest
11-
if: github.event.pull_request.merged == true && startsWith(github.ref, 'refs/heads/release/')
10+
runs-on: ubuntu-22.04
11+
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.base.ref, 'release/')
1212
permissions:
1313
issues: write
14+
contents: read
1415
steps:
15-
- name: Extract issue number
16-
id: extract_issue_number
16+
- name: Extract and close all linked issues
1717
run: |
18-
issue_number=$(echo "${{ github.event.pull_request.body }}" | grep -oE '#[0-9]+' | head -n 1 | tr -d '#')
19-
echo "ISSUE_NUMBER=$issue_number" >> $GITHUB_ENV
18+
# Debug information
19+
echo "=== Debug Information ==="
20+
echo "PR Number: ${{ github.event.pull_request.number }}"
21+
echo "Source Branch: ${{ github.event.pull_request.head.ref }}"
22+
echo "Target Branch: ${{ github.event.pull_request.base.ref }}"
23+
echo "Repository: ${{ github.repository }}"
24+
echo "Repository Owner: ${{ github.repository_owner }}"
25+
echo "Repository Name: ${{ github.event.repository.name }}"
26+
echo "========================="
27+
28+
# Get linked issues using GitHub's GraphQL API
29+
# This matches exactly what GitHub shows in "Successfully merging this pull request may close these issues"
30+
31+
echo "Fetching GitHub-linked issues..."
32+
33+
# Check if jq is installed
34+
if ! command -v jq >/dev/null 2>&1; then
35+
echo "Error: jq is not installed. Please install jq to run this script."
36+
exit 1
37+
fi
38+
39+
# Use GraphQL to get the exact same data GitHub shows in the UI
40+
graphql_response=$(curl -s -X POST \
41+
-H "Accept: application/vnd.github.v4+json" \
42+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
43+
-d '{
44+
"query": "query($owner: String!, $repo: String!, $number: Int!) {
45+
repository(owner: $owner, name: $repo) {
46+
pullRequest(number: $number) {
47+
closingIssuesReferences(first: 100) {
48+
nodes {
49+
number
50+
}
51+
}
52+
}
53+
}
54+
}",
55+
"variables": {
56+
"owner": "${{ github.repository_owner }}",
57+
"repo": "${{ github.event.repository.name }}",
58+
"number": ${{ github.event.pull_request.number }}
59+
}
60+
}' \
61+
https://api.github.com/graphql)
62+
63+
# Debug: Show the raw GraphQL response
64+
echo "GraphQL Response: $graphql_response"
65+
66+
# Check for GraphQL errors or malformed response
67+
if ! echo "$graphql_response" | jq . >/dev/null 2>&1; then
68+
echo "Error: Malformed JSON response from GitHub GraphQL API"
69+
echo "$graphql_response"
70+
exit 1
71+
fi
2072
21-
- name: Close linked issues
22-
uses: peter-evans/close-issue@v3
23-
with:
24-
issue-number: ${{ env.ISSUE_NUMBER }}
25-
comment: "This issue is being closed because the related PR has been merged into a release branch."
73+
if [ "$(echo "$graphql_response" | jq '.errors')" != "null" ]; then
74+
echo "Error(s) returned from GitHub GraphQL API:"
75+
echo "$graphql_response" | jq '.errors'
76+
exit 1
77+
fi
78+
79+
# Extract issue numbers from GraphQL response, handling null closingIssuesReferences
80+
issue_numbers=$(echo "$graphql_response" | jq -r '
81+
if .data.repository.pullRequest.closingIssuesReferences then
82+
.data.repository.pullRequest.closingIssuesReferences.nodes[].number
83+
else
84+
empty
85+
end' | sort -u)
86+
87+
if [ -z "$issue_numbers" ]; then
88+
echo "No linked issues found via GraphQL. Trying fallback method..."
89+
90+
# Fallback: Check PR description for closing keywords
91+
pr_body="${{ github.event.pull_request.body }}"
92+
echo "PR Body: $pr_body"
93+
94+
# Extract issue numbers from PR body using common closing keywords and multiple formats
95+
fallback_issues=$(echo "$pr_body" | grep -ioE '(close[sd]?|fix(e[sd])?|resolve[sd]?)[: ]+((#[0-9]+([, ]+)?)+)' | grep -oE '#[0-9]+' | sed 's/#//' | sort -u)
96+
97+
if [ -n "$fallback_issues" ]; then
98+
echo "Found issues via fallback method: $fallback_issues"
99+
issue_numbers="$fallback_issues"
100+
else
101+
echo "No linked issues found that would be closed by GitHub's automatic linking or PR body keywords"
102+
exit 0
103+
fi
104+
fi
105+
106+
echo "Found GitHub-linked issues: $issue_numbers"
107+
108+
# Close each issue individually
109+
for issue_number in $issue_numbers; do
110+
if [ -n "$issue_number" ]; then
111+
echo "Closing issue #$issue_number"
112+
113+
# Close the issue using robust HTTP response handling
114+
close_tmpfile=$(mktemp)
115+
close_headers=$(mktemp)
116+
curl -s -D "$close_headers" -o "$close_tmpfile" -X PATCH \
117+
-H "Accept: application/vnd.github.v3+json" \
118+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
119+
-H "X-GitHub-Api-Version: 2022-11-28" \
120+
"https://api.github.com/repos/${{ github.repository }}/issues/$issue_number" \
121+
-d '{"state":"closed"}'
122+
123+
close_http_code=$(awk 'NR==1 {print $2}' "$close_headers")
124+
125+
if [ "$close_http_code" = "200" ]; then
126+
echo "✅ Successfully closed issue #$issue_number"
127+
128+
# Add a comment to explain why the issue was closed using robust HTTP response handling
129+
comment_tmpfile=$(mktemp)
130+
comment_headers=$(mktemp)
131+
curl -s -D "$comment_headers" -o "$comment_tmpfile" -X POST \
132+
-H "Accept: application/vnd.github.v3+json" \
133+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
134+
-H "X-GitHub-Api-Version: 2022-11-28" \
135+
"https://api.github.com/repos/${{ github.repository }}/issues/$issue_number/comments" \
136+
-d "{\"body\":\"This issue is being closed because the related PR #${{ github.event.pull_request.number }} has been merged into a release branch (\`${{ github.event.pull_request.base.ref }}\`).\"}"
137+
138+
comment_http_code=$(awk 'NR==1 {print $2}' "$comment_headers")
139+
140+
if [ "$comment_http_code" = "201" ]; then
141+
echo "✅ Added comment to issue #$issue_number"
142+
else
143+
echo "⚠️ Failed to add comment to issue #$issue_number (HTTP $comment_http_code)"
144+
echo "Comment response: $(cat "$comment_tmpfile")"
145+
fi
146+
147+
# Clean up comment temp files
148+
rm -f "$comment_tmpfile" "$comment_headers"
149+
else
150+
echo "❌ Failed to close issue #$issue_number (HTTP $close_http_code)"
151+
echo "Close response: $(cat "$close_tmpfile")"
152+
fi
153+
154+
# Clean up close temp files
155+
rm -f "$close_tmpfile" "$close_headers"
156+
fi
157+
done

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
jobs:
1616
analyze:
1717
name: Analyze (${{ matrix.language }})
18-
runs-on: ${{ 'ubuntu-latest' }}
18+
runs-on: ${{ 'ubuntu-22.04' }}
1919
permissions:
2020
security-events: write
2121
packages: read

.github/workflows/delete-untagged-images.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ env:
2121

2222
jobs:
2323
delete-untagged-ghcr:
24-
runs-on: ubuntu-latest
24+
runs-on: ubuntu-22.04
2525
steps:
2626
- name: Login to GitHub Container Registry
2727
uses: docker/login-action@v3

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ jobs:
1919
uses: softprops/action-gh-release@v2
2020
with:
2121
generate_release_notes: true
22-
body: "Make sure you have read our [breaking changes](https://github.com/Security-Tools-Alliance/rengine-ng/wiki/Installation#breaking-changes) and [how to update](https://github.com/Security-Tools-Alliance/rengine-ng/wiki/Installation#-updating-rengine-ng). The changelog is as follows:"
22+
body: |
23+
Make sure you have read our [breaking changes](https://github.com/Security-Tools-Alliance/rengine-ng/wiki/Installation#breaking-changes) and [how to update](https://github.com/Security-Tools-Alliance/rengine-ng/wiki/Installation#-updating-rengine-ng).
24+
25+
📋 **For a detailed user-friendly changelog, see: [CHANGELOG.md](https://github.com/Security-Tools-Alliance/rengine-ng/blob/master/CHANGELOG.md)**

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ MANIFEST
4242
# IDE files
4343
.vscode/settings.json
4444
.vscode/tasks-and-contexts.json
45+
.idea/
4546

4647
*.manifest
4748
*.spec

0 commit comments

Comments
 (0)