Upgrade secure analyzer projects to report v6.0.0 and integration-test v2
Proposal
Now that Bump security report schema revision version (gitlab-org/security-products/analyzers/report!117 - merged) • Shao Ming Tan has been merged and report v6.0.0 has been released, we need to:
- Bump the
reportpackage tov6.0.0and thecommandpackage tov4.0.0in all of our analyzer projects. - Regenerate all the expectations in our analyzer projects, because the schema version value has changed from
15.1.4to15.2.2.
We can leverage Add ability for image integration test to regen... (#407122 - closed) • Adam Cohen • 18.3 to easily address item 2.
Implementation Plan
-
Migrate the following projects to
integration-test v2and bump thereportpackage tov6:-
Shared packages -
Category:SAST analyzers -
Category:Secret Detection analyzers -
Category:Dependency Management analyzers
Migration Steps:
-
Update
imagereference in theintegration-testto point to theintegration-test:2image:integration-test: image: - name: registry.gitlab.com/gitlab-org/security-products/analyzers/integration-test:stable + name: registry.gitlab.com/gitlab-org/security-products/analyzers/integration-test:2 services: - docker:27-dind variables: -
Replace all occurrences of
recorded_reportwithexpectation_pathinspec/<project>_image_spec.rb:+ let(:report_name) { 'gl-sast-report.json'} context 'with ansible' do let(:project) { 'ansible' } context 'by default' do + let(:expectation_path) { File.join(expectations_dir, project, 'default', report_name) } it_behaves_like 'successful scan' describe 'created report' do it_behaves_like 'non-empty report' - - it_behaves_like 'recorded report' do - let(:recorded_report) { sorted_report(parse_expected_report('ansible/default')) } - end - + it_behaves_like 'recorded report' it_behaves_like 'valid report' end end -
Remove the parse_expected_report function from all specs.
-
-
Regenerate all the expectations:
docker run -it --rm -v "$PWD:$PWD" -w "$PWD" \ -e TMP_IMAGE=<project-image> \ -e REFRESH_EXPECTED=true \ -v /var/run/docker.sock:/var/run/docker.sock \ registry.gitlab.com/gitlab-org/security-products/analyzers/integration-test:2 rspec spec/<project>_image_spec.rb