Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .devops #261

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .devops/credscan/appcat-rulesets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"tool": "Credential Scanner",
"suppressions": [
{
"file": [
"rules/rules-reviewed/azure/tests/data/azure-database-config/application-prod.properties",
"rules/rules-reviewed/azure/tests/data/azure-database-config/application.properties",
"rules/rules-reviewed/azure/tests/data/azure-keystore-certificates/test.jks",
"rules/rules-reviewed/azure/tests/data/azure-password/application-prod.properties",
"rules/rules-reviewed/azure/tests/data/azure-password/application.properties",
"rules/rules-reviewed/azure/tests/data/azure-password/application.yaml",
"rules/rules-reviewed/eap6/jboss-eap4/tests/samples/mysql-ds.xml",
"rules/rules-reviewed/azure/eap/test/data/eap-to-azure-appservice-datasource-driver/postgresql-ds.xml",
"rules/rules-reviewed/quarkus/springboot/tests/data/springboot-metrics/application.properties"
],
"_justification": "Test values for unit tests run locally during CI/CD or local development only. No external systems are affected or named."
},
{
"file": [
"rules/scripts/output-data/all_rules.xml",
"rules/scripts/output-data/all_rules.csv",
"rules/rules-archived/eap6/weblogic/weblogic-webservices.windup.xml",
"rules/rules-reviewed/eap7/weblogic/weblogic-webservices.windup.xml",
"rules/migration-core/eap7/weblogic/weblogic-webservices.windup.xml"
],
"_justification": "Documentation only, sets an example on how to use the reference model only."
},
{
"file": [
"appcat-rulesets/rules/target/classes/azure/tests/data/azure-password/application.yaml",
"appcat-rulesets/rules/target/classes/azure/tests/data/azure-password/application.properties",
"appcat-rulesets/rules/target/classes/azure/tests/data/azure-password/application-prod.properties",
"appcat-rulesets/rules/target/classes/azure/tests/data/azure-database-config/application.properties",
"appcat-rulesets/rules/target/classes/azure/tests/data/azure-database-config/application-prod.properties",
"appcat-rulesets/rules/target/classes/azure/tests/data/azure-keystore-certificates/test.jks",
"appcat-rulesets/rules/target/classes/eap6/jboss-eap4/tests/samples/mysql-ds.xml",
"appcat-rulesets/rules/target/classes/quarkus/springboot/tests/data/springboot-metrics/application.properties"
],
"_justification": "These files are previously scanned and suppressed. These are used for testing purposes. These are not included in any final product."
}
]
}
106 changes: 106 additions & 0 deletions .devops/rulesets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@

schedules:
- cron: "30 23 * * 6"
displayName: Build
always: true
branches:
include:
- dev

variables:
- name: version
value: "3.8.8"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not 3.9.9? Or was there an issue with later versions? I think @kthatipally told me something once...

Extra side note, we should just add mvnw to the Windup build and not have to worry about this. I can pair with someone to do that quickly if that's desirable (it would also change need to use Maven@4 task).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If my suggestion here holds things up then let's not do my suggestion, but open up an issue for later on. Keen to get this merged and make forward progress (can also fix those tests separately as they are unrelated).

Copy link
Collaborator Author

@joe-braley joe-braley Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is WIP. All suggestions are welcome 😄

I need to check this YAML into the repo since I cannot run ADO pipelines from a fork (and therefore cannot execute any test runs). I could point this to a different branch, but I do not have those permissions.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I do see a mvnw checked into the repo already. Could we use that? Assumption is yes.

I will also update the Maven task.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was provided with access to the repo recently. Once I verify that I can create a branch to develop on I will close this PR.

Apologies for the noise.

- name: download_dir
value: "$(Agent.BuildDirectory)/apache-maven-${{ variables.maven_version }}"
- name: options
value: "-Dmaven.repo.local=$(Agent.BuildDirectory)/.m2/repository"

resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release

- repository: appcat-rulesets
type: GitHub
endpoint: $(ENDPOINT)
name: Azure/appcat-rulesets
ref: dev

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
sdl:
sourceAnalysisPool:
name: JEG-windows2022-x64-release
os: windows
sourceRepositoriesToScan:
include:
- repository: appcat-rulesets
runInSingleJob: true
credscan:
enabled: true
justificationForDisabling: "The suppression file is located in this repo at .config/credscan/appcat-rulesets.json. All Credscan issues are test-only and documeted examples."
suppressionsFile: $(Pipeline.Workspace)/s/appcat-rulesets/.config/credscan/appcat-rulesets.json
stages:
- stage:
displayName: "Build"
jobs:
- job: build
displayName: Build appcat-rulesets
pool:
name: JEG-ubuntu20.04-x64-EO
os: linux
steps:
- checkout: appcat-rulesets
path: s/appcat-rulesets

- bash: |
az artifacts universal download \
--organization "$(ORGANIZATION)" \
--feed "$(FEED)" \
--name "$(ARTIFACT)" \
--version "${{ variables.version }}" \
--path .
displayName: "Download Maven"
env:
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)

- bash: |
tar xf apache-maven-${{ variables.version }}-bin.tar.gz -C $(Agent.BuildDirectory)/
echo "##vso[task.prependpath]${{ variables.download_dir }}/bin"
displayName: "Install Maven"

- bash: |
mkdir ~/.m2 \|| true
cat <<EOF > ~/.m2/settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>central</id>
<username>$(USERNAME)</username>
<password>\${env.SYSTEM_ACCESSTOKEN}</password>
</server>
</servers>
</settings>
EOF
displayName: 'Create settings.xml'

- task: Maven@4
displayName: "Build appcat profile"
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs:
mavenPomFile: "$(Build.SourcesDirectory)/pom.xml"
mavenVersionOption: "Path"
mavenDirectory: "${{ variables.download_dir }}"
mavenOptions: "-Xmx3072m ${{ variables.options }}"
javaHomeOption: "JDKVersion"
jdkVersionOption: "1.11"
jdkArchitectureOption: "x64"
publishJUnitResults: false
goals: "install -DskipTests -B -U -P appcat"
Loading