Skip to content

Commit 9202da0

Browse files
committed
Nh-89340: init commit for reverse lab ci
1 parent 37f11c0 commit 9202da0

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) 2023 SolarWinds, LLC.
2+
# All rights reserved.
3+
4+
name: CI Reverse Lab Scan
5+
6+
on:
7+
workflow_dispatch:
8+
9+
jobs:
10+
ci-reverse-lab-scan:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Ruby 3.1 and bundle
17+
uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: 3.1
20+
21+
- name: Build apm-ruby
22+
id: build-apm-ruby-ci-reverse-lab
23+
run: |
24+
sudo apt-get update && sudo apt-get install -y --no-install-recommends ruby ruby-dev g++ make swig bison json
25+
sudo gem install bundler
26+
sudo echo 'gem: --no-document' >> ~/.gemrc
27+
sudo bundle install --without development --without test
28+
sudo gem build solarwinds_apm.gemspec
29+
CURRENT_GEM=$(ls | grep solarwinds_apm-*.gem)
30+
GEM_VERSION=$(echo "$CURRENT_GEM" | grep -oP '(?<=solarwinds_apm-)[0-9]+\.[0-9]+\.[0-9]+(\.[a-z0-9]+)?(?=\.gem)')
31+
echo "current_gem=$CURRENT_GEM" >> $GITHUB_OUTPUT
32+
echo "gem_version=$GEM_VERSION" >> $GITHUB_OUTPUT
33+
34+
- name: Run Reverse Lab Scan
35+
run: |
36+
docker run --rm \
37+
-u $(id -u):$(id -g) \
38+
-v "$(pwd)/:/packages:ro" \
39+
-v "$(pwd)/reports:/reports" \
40+
-e RLPORTAL_ACCESS_TOKEN=${{ secrets.REVERSE_LAB_TOKEN }} \
41+
reversinglabs/rl-scanner-cloud \
42+
rl-scan \
43+
--rl-portal-server solarwinds \
44+
--rl-portal-org SolarWinds \
45+
--rl-portal-group "SaaS - Agents- SWO" \
46+
--purl solarwinds-apm-ruby/apm-ruby@${{ steps.build-apm-ruby-ci-reverse-lab.outputs.gem_version }} \
47+
--file-path /packages/${{ steps.build-apm-ruby-ci-reverse-lab.outputs.current_gem }} \
48+
--report-path /reports \
49+
--report-format all
50+
51+
- name: Check Scan Status
52+
working-directory: .github/workflows/scripts
53+
run: ruby ci-reverse-lab-scan.rb
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright (c) 2024 SolarWinds, LLC.
2+
# All rights reserved.
3+
4+
require 'json'
5+
6+
scan_report_path = '../../../reports/report.checks.json'
7+
if File.exist?(scan_report_path)
8+
content = File.read(scan_report_path)
9+
parsed_data = JSON.parse(content)
10+
assessments = parsed_data['report']['scans']['scan-version']['assessments']
11+
12+
assessments.each do |key, value|
13+
if value['status'] != 'pass'
14+
puts "Found issue. Please check https://my.secure.software/."
15+
exit(1)
16+
end
17+
end
18+
else
19+
puts "Missing scanned report."
20+
exit(1)
21+
end
22+
23+
exit(0)

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,6 @@ lambda/.aws-sam/*
7878
lambda/*.zip
7979
*.zip
8080
lambda/build/*
81+
82+
# reverse lab reports
83+
reports/

0 commit comments

Comments
 (0)