github2gerrit 0.1.6__tar.gz → 0.1.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.github/workflows/dependencies.yaml +3 -4
- github2gerrit-0.1.7/.github/workflows/testing.yaml +305 -0
- github2gerrit-0.1.7/.markdownlint.yaml +24 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.pre-commit-config.yaml +7 -1
- github2gerrit-0.1.7/PKG-INFO +798 -0
- github2gerrit-0.1.7/README.md +758 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/action.yaml +24 -6
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/pyproject.toml +53 -5
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/sitecustomize.py +2 -7
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit/cli.py +457 -186
- github2gerrit-0.1.7/src/github2gerrit/commit_normalization.py +471 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit/core.py +828 -251
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit/duplicate_detection.py +1 -67
- github2gerrit-0.1.7/src/github2gerrit/external_api.py +518 -0
- github2gerrit-0.1.7/src/github2gerrit/gerrit_rest.py +298 -0
- github2gerrit-0.1.7/src/github2gerrit/gerrit_urls.py +353 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit/github_api.py +12 -79
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit/gitutils.py +216 -49
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit/models.py +2 -0
- github2gerrit-0.1.7/src/github2gerrit/pr_content_filter.py +476 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit/similarity.py +2 -2
- github2gerrit-0.1.7/src/github2gerrit/ssh_agent_setup.py +351 -0
- github2gerrit-0.1.7/src/github2gerrit/ssh_common.py +244 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit/ssh_discovery.py +4 -0
- github2gerrit-0.1.7/src/github2gerrit/utils.py +113 -0
- github2gerrit-0.1.7/src/github2gerrit.egg-info/PKG-INFO +798 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit.egg-info/SOURCES.txt +20 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit.egg-info/requires.txt +1 -1
- github2gerrit-0.1.7/tests/test_change_id_deduplication.py +325 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_cli.py +19 -1
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_cli_outputs_file.py +3 -3
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_cli_url_and_dryrun.py +4 -1
- github2gerrit-0.1.7/tests/test_commit_normalization.py +329 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_core_config_and_errors.py +28 -12
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_core_gerrit_push_errors.py +4 -4
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_core_gerrit_rest_results.py +42 -24
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_core_integration_fixture_repo.py +4 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_core_prepare_commits.py +2 -1
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_core_ssh_setup.py +28 -14
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_duplicate_detection.py +0 -73
- github2gerrit-0.1.7/tests/test_external_api_framework.py +244 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_gerrit_change_id_footer.py +2 -0
- github2gerrit-0.1.7/tests/test_gerrit_rest_client.py +265 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_gerrit_urls.py +28 -14
- github2gerrit-0.1.7/tests/test_gerrit_urls_more.py +228 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_github_api_retry_and_helpers.py +44 -8
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_gitutils_helpers.py +8 -8
- github2gerrit-0.1.7/tests/test_misc_small_coverage.py +72 -0
- github2gerrit-0.1.7/tests/test_pr_content_filter.py +449 -0
- github2gerrit-0.1.7/tests/test_pr_content_filter_integration.py +289 -0
- github2gerrit-0.1.7/tests/test_ssh_agent.py +427 -0
- github2gerrit-0.1.7/tests/test_ssh_common.py +368 -0
- github2gerrit-0.1.7/tests/test_utils.py +316 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/uv.lock +59 -61
- github2gerrit-0.1.6/PKG-INFO +0 -552
- github2gerrit-0.1.6/README.md +0 -512
- github2gerrit-0.1.6/src/github2gerrit/gerrit_urls.py +0 -256
- github2gerrit-0.1.6/src/github2gerrit.egg-info/PKG-INFO +0 -552
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.editorconfig +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.github/actionlint.yaml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.github/dependabot.yml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.github/release-drafter.yml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.github/workflows/build-test-release.yaml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.github/workflows/build-test.yaml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.github/workflows/github2gerrit.yaml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.github/workflows/release-drafter.yaml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.github/workflows/semantic-pull-request.yaml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.github/workflows/sha-pinned-actions.yaml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.gitignore +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.gitlint +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.readthedocs.yml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/.yamllint +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/LICENSE +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/LICENSES/Apache-2.0.txt +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/REUSE.toml +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/setup.cfg +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit/__init__.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit/config.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit.egg-info/dependency_links.txt +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit.egg-info/entry_points.txt +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/src/github2gerrit.egg-info/top_level.txt +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/conftest.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/fixtures/__init__.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/fixtures/make_repo.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_cli_helpers.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_config_and_reviewers.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_config_helpers.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_core_close_pr_policy.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_core_gerrit_backref_comment.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_ghe_and_gitreview_args.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_github_api_helpers.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_ssh_discovery.py +0 -0
- {github2gerrit-0.1.6 → github2gerrit-0.1.7}/tests/test_url_parser.py +0 -0
@@ -13,15 +13,14 @@ on:
|
|
13
13
|
push:
|
14
14
|
branches:
|
15
15
|
- 'main'
|
16
|
-
- 'master'
|
17
16
|
paths:
|
18
17
|
- '**'
|
19
18
|
- '!.github/**'
|
20
19
|
- '!.*'
|
20
|
+
- '!pdm.lock'
|
21
21
|
- '!tox.ini'
|
22
22
|
|
23
|
-
|
24
|
-
python-version: 3.11
|
23
|
+
# Python version derived from pyproject.toml via setup-python step
|
25
24
|
|
26
25
|
permissions: {}
|
27
26
|
|
@@ -45,4 +44,4 @@ jobs:
|
|
45
44
|
# yamllint disable-line rule:line-length
|
46
45
|
- uses: lfreleng-actions/python-dependencies-update-action@f81d67225c672cddbe56d8234b69868a797c75e7 # v0.1.3
|
47
46
|
with:
|
48
|
-
token: ${{ secrets.GITHUB_TOKEN }}
|
47
|
+
token: "${{ secrets.GITHUB_TOKEN }}"
|
@@ -0,0 +1,305 @@
|
|
1
|
+
---
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
3
|
+
# SPDX-FileCopyrightText: 2025 The Linux Foundation
|
4
|
+
|
5
|
+
name: 'Test GitHub Action 🧪'
|
6
|
+
|
7
|
+
# yamllint disable-line rule:truthy
|
8
|
+
on:
|
9
|
+
workflow_dispatch:
|
10
|
+
push:
|
11
|
+
branches: ['main']
|
12
|
+
pull_request:
|
13
|
+
branches: ['main']
|
14
|
+
|
15
|
+
concurrency:
|
16
|
+
group: "${{ github.workflow }}-${{ github.ref }}"
|
17
|
+
cancel-in-progress: true
|
18
|
+
|
19
|
+
permissions: {}
|
20
|
+
|
21
|
+
jobs:
|
22
|
+
### Test the GitHub Action in this Repository (PR context only) ###
|
23
|
+
tests:
|
24
|
+
name: 'Test GitHub Action'
|
25
|
+
runs-on: 'ubuntu-latest'
|
26
|
+
permissions:
|
27
|
+
contents: read
|
28
|
+
timeout-minutes: 10 # Increase this timeout value as needed
|
29
|
+
# Only run on pull requests - action needs PR context
|
30
|
+
if: ${{ github.event_name == 'pull_request' }}
|
31
|
+
steps:
|
32
|
+
- name: 'Checkout repository'
|
33
|
+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
34
|
+
|
35
|
+
- name: "Running local action: ${{ github.repository }}"
|
36
|
+
uses: ./
|
37
|
+
env:
|
38
|
+
G2G_DRYRUN_DISABLE_NETWORK: 'true'
|
39
|
+
with:
|
40
|
+
GERRIT_KNOWN_HOSTS: 'dummy-host ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC...'
|
41
|
+
GERRIT_SSH_PRIVKEY_G2G: 'dummy-key'
|
42
|
+
DRY_RUN: 'true'
|
43
|
+
|
44
|
+
# yamllint disable-line rule:line-length
|
45
|
+
- name: "Running local action: ${{ github.repository }} [Failure]"
|
46
|
+
uses: ./
|
47
|
+
id: failure
|
48
|
+
continue-on-error: true
|
49
|
+
env:
|
50
|
+
G2G_DRYRUN_DISABLE_NETWORK: 'true'
|
51
|
+
with:
|
52
|
+
GERRIT_KNOWN_HOSTS: "dummy-host ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC..."
|
53
|
+
GERRIT_SSH_PRIVKEY_G2G: ""
|
54
|
+
DRY_RUN: 'true'
|
55
|
+
|
56
|
+
# Failure testing is also important
|
57
|
+
- name: "Error if step above did NOT fail"
|
58
|
+
if: steps.failure.outcome == 'success'
|
59
|
+
shell: bash
|
60
|
+
run: |
|
61
|
+
# Error if step above did NOT fail
|
62
|
+
echo "Error: previous test step did NOT fail ❌"
|
63
|
+
exit 1
|
64
|
+
|
65
|
+
### CLI Integration Test with LF Gerrit Server ###
|
66
|
+
cli-integration-test:
|
67
|
+
name: 'Integration Tests'
|
68
|
+
runs-on: 'ubuntu-latest'
|
69
|
+
permissions:
|
70
|
+
contents: read
|
71
|
+
timeout-minutes: 15
|
72
|
+
# Only run on workflow_dispatch or push to main - tests CLI not action
|
73
|
+
# yamllint disable-line rule:line-length
|
74
|
+
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
|
75
|
+
steps:
|
76
|
+
# yamllint disable-line rule:line-length
|
77
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
78
|
+
|
79
|
+
- name: 'Setup Python'
|
80
|
+
# yamllint disable-line rule:line-length
|
81
|
+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
82
|
+
with:
|
83
|
+
python-version-file: 'pyproject.toml'
|
84
|
+
|
85
|
+
- name: "Install uv"
|
86
|
+
# yamllint disable-line rule:line-length
|
87
|
+
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
|
88
|
+
|
89
|
+
- name: 'Test CLI integration with Gerrit [Dry Run]'
|
90
|
+
shell: bash
|
91
|
+
env:
|
92
|
+
# GitHub variables passed to CLI
|
93
|
+
GITHUB_TOKEN: "${{ github.token }}"
|
94
|
+
GITHUB_EVENT_NAME: 'workflow_dispatch'
|
95
|
+
GITHUB_REPOSITORY: "${{ github.repository }}"
|
96
|
+
GITHUB_REPOSITORY_OWNER: "${{ github.repository_owner }}"
|
97
|
+
GITHUB_SERVER_URL: "${{ github.server_url }}"
|
98
|
+
GITHUB_RUN_ID: "${{ github.run_id }}"
|
99
|
+
GITHUB_SHA: "${{ github.sha }}"
|
100
|
+
# Gerrit configuration
|
101
|
+
GERRIT_KNOWN_HOSTS: "${{ vars.GERRIT_KNOWN_HOSTS }}"
|
102
|
+
GERRIT_SSH_PRIVKEY_G2G: "${{ secrets.GERRIT_SSH_PRIVKEY_G2G }}"
|
103
|
+
GERRIT_SERVER: 'gerrit.linuxfoundation.org'
|
104
|
+
GERRIT_PROJECT: 'sandbox'
|
105
|
+
DRY_RUN: 'true'
|
106
|
+
ALLOW_DUPLICATES: 'true'
|
107
|
+
PRESERVE_GITHUB_PRS: 'true'
|
108
|
+
G2G_VERBOSE: 'true'
|
109
|
+
# Override .gitreview file from external repo (onap/portal-ng-bff)
|
110
|
+
# This forces CLI to use our environment variables instead of
|
111
|
+
# the external repo's .gitreview which points elsewhere
|
112
|
+
CI_TESTING: 'true'
|
113
|
+
run: |
|
114
|
+
echo "Testing GitHub2Gerrit CLI integration with LF Gerrit server..."
|
115
|
+
echo "Target PR: ${{ vars.DEPENDABOT_PR_URL }}"
|
116
|
+
|
117
|
+
if [[ -z "${{ vars.DEPENDABOT_PR_URL }}" ]]; then
|
118
|
+
echo "❌ DEPENDABOT_PR_URL variable not set"
|
119
|
+
echo "Please set this GitHub repository variable to a valid PR URL for testing"
|
120
|
+
exit 1
|
121
|
+
fi
|
122
|
+
|
123
|
+
# Debug: Show what URL we're parsing
|
124
|
+
echo "Parsing URL: ${{ vars.DEPENDABOT_PR_URL }}"
|
125
|
+
|
126
|
+
# Test with external PR URL using uvx
|
127
|
+
echo "Running: uvx --from . github2gerrit ${{ vars.DEPENDABOT_PR_URL }}"
|
128
|
+
uvx --from . github2gerrit "${{ vars.DEPENDABOT_PR_URL }}"
|
129
|
+
|
130
|
+
echo "✅ Dry-run CLI integration test completed successfully"
|
131
|
+
{
|
132
|
+
echo "CLI Integration test summary:"
|
133
|
+
echo "- Tested with external PR: ${{ vars.DEPENDABOT_PR_URL }}"
|
134
|
+
echo "- Target Gerrit: gerrit.linuxfoundation.org"
|
135
|
+
echo "- Target Project: sandbox"
|
136
|
+
echo "- Mode: DRY_RUN (validation only)"
|
137
|
+
} >> "$GITHUB_STEP_SUMMARY"
|
138
|
+
|
139
|
+
- name: "Test CLI integration with Gerrit"
|
140
|
+
shell: bash
|
141
|
+
env:
|
142
|
+
# GitHub context (needed for CLI operation)
|
143
|
+
GITHUB_TOKEN: "${{ github.token }}"
|
144
|
+
GITHUB_EVENT_NAME: 'workflow_dispatch'
|
145
|
+
GITHUB_REPOSITORY: "${{ github.repository }}"
|
146
|
+
GITHUB_REPOSITORY_OWNER: "${{ github.repository_owner }}"
|
147
|
+
GITHUB_SERVER_URL: "${{ github.server_url }}"
|
148
|
+
GITHUB_RUN_ID: "${{ github.run_id }}"
|
149
|
+
GITHUB_SHA: "${{ github.sha }}"
|
150
|
+
# Gerrit configuration - force override of .gitreview
|
151
|
+
GERRIT_KNOWN_HOSTS: "${{ vars.GERRIT_KNOWN_HOSTS }}"
|
152
|
+
GERRIT_SSH_PRIVKEY_G2G: "${{ secrets.GERRIT_SSH_PRIVKEY_G2G }}"
|
153
|
+
GERRIT_SSH_USER_G2G: 'modesevenindustrialsolutions'
|
154
|
+
GERRIT_SSH_USER_G2G_EMAIL: 'mwatkins@linuxfoundation.org'
|
155
|
+
GERRIT_SERVER: 'gerrit.linuxfoundation.org'
|
156
|
+
GERRIT_PROJECT: 'sandbox'
|
157
|
+
GERRIT_SERVER_PORT: '29418'
|
158
|
+
DRY_RUN: 'false'
|
159
|
+
ALLOW_DUPLICATES: 'true'
|
160
|
+
PRESERVE_GITHUB_PRS: 'true'
|
161
|
+
G2G_VERBOSE: 'true'
|
162
|
+
FETCH_DEPTH: '50'
|
163
|
+
USE_PR_AS_COMMIT: 'true'
|
164
|
+
# Override .gitreview file from external repo (onap/portal-ng-bff)
|
165
|
+
# This forces CLI to use our environment variables instead of
|
166
|
+
# the external repo's .gitreview which points elsewhere
|
167
|
+
CI_TESTING: 'true'
|
168
|
+
# Force derivation to be disabled so our overrides take precedence
|
169
|
+
G2G_ENABLE_DERIVATION: 'false'
|
170
|
+
run: |
|
171
|
+
echo '🚀 Integration Test Summary'
|
172
|
+
echo "Target PR: ${{ vars.DEPENDABOT_PR_URL }}"
|
173
|
+
|
174
|
+
# Configure git with your identity
|
175
|
+
# Gerrit private SSH key is linked to this account
|
176
|
+
git config --global user.name "$GERRIT_SSH_USER_G2G"
|
177
|
+
git config --global user.email "$GERRIT_SSH_USER_G2G_EMAIL"
|
178
|
+
|
179
|
+
# Push to Gerrit
|
180
|
+
echo "Pushing change to Gerrit..."
|
181
|
+
uvx --from . github2gerrit "${{ vars.DEPENDABOT_PR_URL }}"
|
182
|
+
|
183
|
+
### ONAP Integration Test ###
|
184
|
+
onap-integration-test:
|
185
|
+
name: 'ONAP Integration Test'
|
186
|
+
runs-on: 'ubuntu-latest'
|
187
|
+
permissions:
|
188
|
+
contents: read
|
189
|
+
timeout-minutes: 15
|
190
|
+
# Only run on workflow_dispatch or push to main
|
191
|
+
# yamllint disable-line rule:line-length
|
192
|
+
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main') }}
|
193
|
+
steps:
|
194
|
+
# yamllint disable-line rule:line-length
|
195
|
+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
196
|
+
|
197
|
+
- name: 'Setup Python'
|
198
|
+
# yamllint disable-line rule:line-length
|
199
|
+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
200
|
+
with:
|
201
|
+
python-version-file: 'pyproject.toml'
|
202
|
+
|
203
|
+
- name: "Install uv"
|
204
|
+
# yamllint disable-line rule:line-length
|
205
|
+
uses: astral-sh/setup-uv@4959332f0f014c5280e7eac8b70c90cb574c9f9b # v6.6.0
|
206
|
+
|
207
|
+
- name: 'Configure ONAP Gerrit SSH Key'
|
208
|
+
shell: bash
|
209
|
+
env:
|
210
|
+
ONAP_SSH_KEY: "${{ secrets.ONAP_GERRIT_SSH_PRIVKEY_G2G }}"
|
211
|
+
ISSUE_ID_VALUE: "${{ vars.ISSUE_ID }}"
|
212
|
+
run: |
|
213
|
+
echo "🔑 Configuring ONAP Gerrit SSH credentials..."
|
214
|
+
|
215
|
+
# Create configuration directory
|
216
|
+
mkdir -p ~/.config/github2gerrit
|
217
|
+
|
218
|
+
# Escape newlines in SSH key for INI format
|
219
|
+
ESCAPED_SSH_KEY=$(echo "$ONAP_SSH_KEY" | sed ':a;N;$!ba;s/\n/\\n/g')
|
220
|
+
|
221
|
+
# Create configuration file with ONAP stanza
|
222
|
+
cat > ~/.config/github2gerrit/configuration.txt << EOF
|
223
|
+
[default]
|
224
|
+
GERRIT_HTTP_USER = "modesevenindustrialsolutions"
|
225
|
+
|
226
|
+
[onap]
|
227
|
+
ISSUE_ID = "$ISSUE_ID_VALUE"
|
228
|
+
GERRIT_SSH_PRIVKEY_G2G = "$ESCAPED_SSH_KEY"
|
229
|
+
EOF
|
230
|
+
|
231
|
+
echo "✅ Configuration file created successfully"
|
232
|
+
|
233
|
+
# Verify config file structure (without showing sensitive content)
|
234
|
+
echo "Configuration file structure:"
|
235
|
+
grep -E '^\[|^[A-Z_]+ =' ~/.config/github2gerrit/configuration.txt | sed 's/=.*/= [REDACTED]/'
|
236
|
+
|
237
|
+
- name: 'Run GitHub2Gerrit CLI with ONAP PR'
|
238
|
+
shell: bash
|
239
|
+
env:
|
240
|
+
# GitHub context
|
241
|
+
GITHUB_TOKEN: "${{ github.token }}"
|
242
|
+
GITHUB_EVENT_NAME: 'workflow_dispatch'
|
243
|
+
GITHUB_REPOSITORY: "${{ github.repository }}"
|
244
|
+
GITHUB_REPOSITORY_OWNER: "${{ github.repository_owner }}"
|
245
|
+
GITHUB_SERVER_URL: "${{ github.server_url }}"
|
246
|
+
GITHUB_RUN_ID: "${{ github.run_id }}"
|
247
|
+
GITHUB_SHA: "${{ github.sha }}"
|
248
|
+
# CLI configuration
|
249
|
+
G2G_VERBOSE: 'true'
|
250
|
+
ORGANIZATION: 'onap'
|
251
|
+
ALLOW_DUPLICATES: 'true'
|
252
|
+
G2G_SKIP_GERRIT_COMMENTS: 'true'
|
253
|
+
CI_TESTING: 'true'
|
254
|
+
run: |
|
255
|
+
echo "🚀 Running GitHub2Gerrit CLI with ONAP PR..."
|
256
|
+
echo "Target PR: https://github.com/onap/portal-ng-bff/pull/37"
|
257
|
+
|
258
|
+
# Configure git identity
|
259
|
+
git config --global user.name "modesevenindustrialsolutions"
|
260
|
+
git config --global user.email "mwatkins@linuxfoundation.org"
|
261
|
+
|
262
|
+
# Run the CLI command
|
263
|
+
uvx --from . github2gerrit https://github.com/onap/portal-ng-bff/pull/37
|
264
|
+
|
265
|
+
echo "✅ GitHub2Gerrit CLI execution completed"
|
266
|
+
|
267
|
+
- name: 'Secure Cleanup of SSH Credentials'
|
268
|
+
if: always()
|
269
|
+
shell: bash
|
270
|
+
run: |
|
271
|
+
echo "🧹 Performing secure cleanup of SSH credentials..."
|
272
|
+
|
273
|
+
# Overwrite configuration file with random data multiple times
|
274
|
+
if [[ -f ~/.config/github2gerrit/configuration.txt ]]; then
|
275
|
+
# Get file size for overwriting
|
276
|
+
file_size=$(stat -f%z ~/.config/github2gerrit/configuration.txt 2>/dev/null || \
|
277
|
+
stat -c%s ~/.config/github2gerrit/configuration.txt)
|
278
|
+
|
279
|
+
# Overwrite with random data 3 times
|
280
|
+
for _ in {1..3}; do
|
281
|
+
dd if=/dev/urandom of=~/.config/github2gerrit/configuration.txt \
|
282
|
+
bs="$file_size" count=1 2>/dev/null || true
|
283
|
+
sync
|
284
|
+
done
|
285
|
+
|
286
|
+
# Final overwrite with zeros
|
287
|
+
dd if=/dev/zero of=~/.config/github2gerrit/configuration.txt \
|
288
|
+
bs="$file_size" count=1 2>/dev/null || true
|
289
|
+
sync
|
290
|
+
|
291
|
+
# Remove the file
|
292
|
+
rm -f ~/.config/github2gerrit/configuration.txt
|
293
|
+
|
294
|
+
# Remove the entire directory if empty
|
295
|
+
rmdir ~/.config/github2gerrit 2>/dev/null || true
|
296
|
+
rmdir ~/.config 2>/dev/null || true
|
297
|
+
fi
|
298
|
+
|
299
|
+
# Clear any environment variables that might contain sensitive data
|
300
|
+
unset ONAP_SSH_KEY ISSUE_ID_VALUE
|
301
|
+
|
302
|
+
# Force garbage collection in bash
|
303
|
+
hash -r
|
304
|
+
|
305
|
+
echo "✅ Secure cleanup completed - no credentials remain on filesystem"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
3
|
+
# SPDX-FileCopyrightText: 2025 The Linux Foundation
|
4
|
+
|
5
|
+
# Markdownlint configuration
|
6
|
+
# See: https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
|
7
|
+
|
8
|
+
default: true
|
9
|
+
|
10
|
+
# Line length rule
|
11
|
+
MD013:
|
12
|
+
line_length: 120
|
13
|
+
code_blocks: false
|
14
|
+
tables: false
|
15
|
+
headings: false
|
16
|
+
|
17
|
+
# Allow raw HTML (for compatibility)
|
18
|
+
MD033: false
|
19
|
+
|
20
|
+
# Allow duplicate headings (common in documentation)
|
21
|
+
MD024: false
|
22
|
+
|
23
|
+
# Allow emphasis markers without surrounding spaces
|
24
|
+
MD036: false
|
@@ -74,6 +74,12 @@ repos:
|
|
74
74
|
- types-PyYAML
|
75
75
|
- types-requests
|
76
76
|
|
77
|
+
- repo: https://github.com/RobertCraigie/pyright-python
|
78
|
+
rev: d393df1703a808473b84bd14a2702f4793014031 # frozen: v1.1.404
|
79
|
+
hooks:
|
80
|
+
- id: pyright
|
81
|
+
files: ^(src|scripts|tests)/.+\.py$
|
82
|
+
|
77
83
|
- repo: https://github.com/btford/write-good
|
78
84
|
rev: ab66ce10136dfad5146e69e70f82a3efac8842c1 # frozen: v1.0.8
|
79
85
|
hooks:
|
@@ -90,7 +96,7 @@ repos:
|
|
90
96
|
rev: 192ad822316c3a22fb3d3cc8aa6eafa0b8488360 # frozen: v0.45.0
|
91
97
|
hooks:
|
92
98
|
- id: markdownlint
|
93
|
-
args: ["--fix"]
|
99
|
+
args: ["--fix", "--config", ".markdownlint.yaml"]
|
94
100
|
exclude: "GERRIT_URL_CENTRALIZATION.md"
|
95
101
|
|
96
102
|
- repo: https://github.com/fsfe/reuse-tool
|