Skip to content

Commit c44ff2c

Browse files
authored
chore: update everything according to the latest standards (#791)
* chore: update everything according to the latest standards * chore: forgot about .addonmatrix * ci: remove codecov integration * chore: wait for Splunk's KVStore to be ready * chore: attach credentials when making request to KVStore API * style: pre-commit run --all-files * chore: actually use response.json() instead of response * chore: update list of internal errors to ignore error from splunk_secure_gateway app * chore: remove KVStore additional verification
1 parent 45ceea9 commit c44ff2c

File tree

9 files changed

+514
-533
lines changed

9 files changed

+514
-533
lines changed

.addonmatrix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--splunkfeatures METRICS_MULTI,PYTHON3

.github/workflows/build-test-release.yml

Lines changed: 40 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
name: Build Test Release
2-
31
on:
42
push:
53
branches:
@@ -16,6 +14,15 @@ concurrency:
1614
cancel-in-progress: true
1715

1816
jobs:
17+
meta:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
matrix_supportedSplunk: ${{ steps.matrix.outputs.supportedSplunk }}
21+
steps:
22+
- uses: actions/checkout@v3
23+
- id: matrix
24+
uses: splunk/addonfactory-test-matrix-action@v1
25+
1926
fossa-scan:
2027
continue-on-error: true
2128
runs-on: ubuntu-latest
@@ -40,13 +47,10 @@ jobs:
4047
FOSSA_API_KEY: ${{ secrets.FOSSA_API_KEY }}
4148

4249
compliance-copyrights:
43-
name: Compliance Copyright Headers
4450
runs-on: ubuntu-latest
4551
steps:
46-
- name: Checkout
47-
uses: actions/checkout@v3
48-
- name: Check License Header
49-
uses: apache/skywalking-eyes@v0.3.0
52+
- uses: actions/checkout@v3
53+
- uses: apache/skywalking-eyes@v0.4.0
5054

5155
pre-commit:
5256
runs-on: ubuntu-latest
@@ -63,8 +67,7 @@ jobs:
6367
if: github.actor != 'dependabot[bot]'
6468
steps:
6569
- uses: actions/checkout@v3
66-
- name: Semgrep
67-
id: semgrep
70+
- id: semgrep
6871
uses: returntocorp/semgrep-action@v1
6972
with:
7073
publishToken: ${{ secrets.SEMGREP_PUBLISH_TOKEN }}
@@ -84,27 +87,16 @@ jobs:
8487
scanArguments: "--max_dept 50 -x .github/workflows/exclude-patterns.txt"
8588

8689
test-splunk-unit:
87-
name: Unit tests
8890
runs-on: ubuntu-latest
8991
steps:
9092
- uses: actions/checkout@v3
9193
with:
9294
submodules: true
9395
- name: Install dependencies
9496
run: |
95-
curl -sSL https://install.python-poetry.org | python3 -
97+
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
9698
poetry install
97-
poetry run coverage run --source=./pytest_splunk_addon/standard_lib -m pytest -v tests/unit
98-
poetry run coverage xml
99-
- name: Upload coverage to Codecov
100-
uses: codecov/codecov-action@v3
101-
with:
102-
token: ${{ secrets.CODECOV_TOKEN }}
103-
files: ./coverage.xml
104-
directory: ./coverage/reports/
105-
env_vars: OS,PYTHON
106-
fail_ci_if_error: true
107-
verbose: true
99+
poetry run pytest -v tests/unit
108100
109101
test-splunk-doc:
110102
name: Test Docs
@@ -118,14 +110,14 @@ jobs:
118110
python-version: 3.7
119111
- name: Install and run tests
120112
run: |
121-
curl -sSL https://install.python-poetry.org | python3 -
113+
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
122114
poetry install --with docs -E docker
123115
poetry run pytest -v -m doc tests/e2e
124116
125117
test-splunk-external:
126118
runs-on: ubuntu-latest
127-
name: Test splunk external
128119
needs:
120+
- meta
129121
- pre-commit
130122
- fossa-scan
131123
- compliance-copyrights
@@ -135,22 +127,21 @@ jobs:
135127
strategy:
136128
fail-fast: false
137129
matrix:
138-
splunk-version: ["8.1", "8.2", "9.0"]
130+
splunk: ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
139131
steps:
140132
- uses: actions/checkout@v3
141133
with:
142134
submodules: true
143135
- name: Setup for testing
144136
run: |
145137
pip install git+https://github.com/pixelb/crudini
146-
mkdir test-results-${{ matrix.splunk-version }}
138+
mkdir test-results-${{ matrix.splunk.version }}
147139
- name: Splunk Up
148140
run: |
149141
export SPLUNK_APP_PACKAGE=./tests/e2e/addons/TA_fiction
150142
export SPLUNK_ADDON=TA_fiction
151143
export SPLUNK_APP_ID=TA_fiction
152-
ls -l deps/build/addonfactory_test_matrix_splunk/splunk_matrix.conf
153-
export SPLUNK_VERSION=$(crudini --get deps/build/addonfactory_test_matrix_splunk/splunk_matrix.conf ${{ matrix.splunk-version }} VERSION)
144+
export SPLUNK_VERSION=${{ matrix.splunk.version }}
154145
echo $SPLUNK_VERSION
155146
docker-compose -f "docker-compose-ci.yml" build
156147
SPLUNK_PASSWORD=Chang3d! docker-compose -f docker-compose-ci.yml up -d splunk
@@ -174,8 +165,8 @@ jobs:
174165
test-results-${{ matrix.splunk-version }}
175166
176167
test-splunk-matrix:
177-
name: Test Matrix
178168
needs:
169+
- meta
179170
- pre-commit
180171
- fossa-scan
181172
- compliance-copyrights
@@ -186,7 +177,7 @@ jobs:
186177
strategy:
187178
fail-fast: false
188179
matrix:
189-
splunk-version: ["8.1", "8.2", "9.0"]
180+
splunk: ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
190181
test-marker: [
191182
"splunk_connection_docker",
192183
"splunk_app_fiction",
@@ -203,18 +194,15 @@ jobs:
203194
- uses: actions/checkout@v3
204195
with:
205196
submodules: true
206-
- name: Set up OS=ubuntu-latest::Python=3.7::Splunk=${{ matrix.splunk-version }}
207-
uses: actions/setup-python@v4
197+
- uses: actions/setup-python@v4
208198
with:
209199
python-version: 3.7
210-
- name: Install and run tests
211-
run: |
212-
curl -sSL https://install.python-poetry.org | python3 -
200+
- run: |
201+
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
213202
poetry install -E docker
214-
poetry run pytest -v --splunk-version=${{ matrix.splunk-version }} -m docker -m ${{ matrix.test-marker }} tests/e2e
203+
poetry run pytest -v --splunk-version=${{ matrix.splunk.version }} -m docker -m ${{ matrix.test-marker }} tests/e2e
215204
216205
publish:
217-
name: publish
218206
needs:
219207
- test-splunk-external
220208
- test-splunk-matrix
@@ -226,8 +214,7 @@ jobs:
226214
# build if this is not set false
227215
submodules: false
228216
persist-credentials: false
229-
- name: Setup python
230-
uses: actions/setup-python@v4
217+
- uses: actions/setup-python@v4
231218
with:
232219
python-version: "3.7"
233220
- uses: actions/download-artifact@v3
@@ -237,16 +224,21 @@ jobs:
237224
run: cp -f THIRDPARTY NOTICE
238225
- name: Install Poetry
239226
run: |
240-
curl -sSL https://install.python-poetry.org | python3 -
241-
- name: Semantic Release
242-
uses: cycjimmy/semantic-release-action@v3.0.0
243-
with:
244-
semantic_version: 19.0.2
227+
curl -sSL https://install.python-poetry.org | python3 - --version 1.4.2
228+
- id: semantic
229+
uses: splunk/semantic-release-action@v1.3
230+
with:
231+
git_committer_name: ${{ secrets.SA_GH_USER_NAME }}
232+
git_committer_email: ${{ secrets.SA_GH_USER_EMAIL }}
233+
gpg_private_key: ${{ secrets.SA_GPG_PRIVATE_KEY }}
234+
passphrase: ${{ secrets.SA_GPG_PASSPHRASE }}
245235
extra_plugins: |
246-
@semantic-release/exec
247-
@semantic-release/git
248236
@google/semantic-release-replace-plugin
249237
env:
250238
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_ADMIN }}
251-
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
252-
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
239+
- if: ${{ steps.semantic.outputs.new_release_published == 'true' }}
240+
uses: splunk/pypi-publish-action@v1.0
241+
with:
242+
pypi_username: ${{ secrets.PYPI_USERNAME }}
243+
pypi_token: ${{ secrets.PYPI_TOKEN }}
244+

.github/workflows/sr-prepare.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/sr-release.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

.releaserc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,8 @@
6262
[
6363
"@semantic-release/exec",
6464
{
65-
"prepareCmd": "./.github/workflows/sr-prepare.sh ${nextRelease.version}",
66-
"publishCmd": "./.github/workflows/sr-release.sh",
67-
"shell": "bash"
65+
"verifyReleaseCmd": "echo \"version=${nextRelease.version}\" >> $GITHUB_OUTPUT",
66+
"successCmd": "echo \"new_release_published=${'true'}\" >> $GITHUB_OUTPUT"
6867
},
6968
],
7069
[

0 commit comments

Comments
 (0)