Skip to content

Commit

Permalink
improve the azure sample with tested configuration (#1273)
Browse files Browse the repository at this point in the history
* improve the azure sample with tested configuration

* change fetch depth to a standard value

---------

Co-authored-by: Sebastian Revuelta <[email protected]>
  • Loading branch information
sebasrevuelta and sebastianrevuelta authored Dec 14, 2023
1 parent d44554d commit a3195b1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
27 changes: 16 additions & 11 deletions src/components/code_snippets/_azure-semgrep-app-sast.mdx
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
```yaml
# trigger:
# - master

pool:
vmImage: ubuntu-latest
variables:
- group: Semgrep Cloud Platform token group

steps:
- group: Semgrep_Variables

steps:
- checkout: self
clean: true
fetchDepth: 20
persistCredentials: true
- script: |
python -m pip install --upgrade pip
pip install semgrep
semgrep ci
env:
SEMGREP_PR_ID: $(System.PullRequest.PullRequestNumber)
if [ $(Build.SourceBranchName) = "master" ]; then
echo "Semgrep full scan"
semgrep ci
elif [ $(System.PullRequest.PullRequestId) -ge 0 ]; then
echo "Semgrep diff scan"
export SEMGREP_PR_ID=$(System.PullRequest.PullRequestId)
export SEMGREP_BASELINE_REF='origin/master'
git fetch origin master:origin/master
semgrep ci
fi
```
### Setting environment variables in Azure Pipelines
Expand Down
27 changes: 16 additions & 11 deletions src/components/code_snippets/_azure-semgrep-app-ssc.mdx
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
```yaml
# trigger:
# - master

pool:
vmImage: ubuntu-latest
variables:
- group: Semgrep Cloud Platform token group

steps:
- group: Semgrep_Variables

steps:
- checkout: self
clean: true
fetchDepth: 20
persistCredentials: true
- script: |
python -m pip install --upgrade pip
pip install semgrep
semgrep ci --supply-chain
env:
SEMGREP_PR_ID: $(System.PullRequest.PullRequestNumber)
if [ $(Build.SourceBranchName) = "master" ]; then
echo "Semgrep full scan"
semgrep ci --supply-chain
elif [ $(System.PullRequest.PullRequestId) -ge 0 ]; then
echo "Semgrep diff scan"
export SEMGREP_PR_ID=$(System.PullRequest.PullRequestId)
export SEMGREP_BASELINE_REF='origin/master'
git fetch origin master:origin/master
semgrep ci --supply-chain
fi
```
### Setting environment variables in Azure Pipelines
Expand Down

0 comments on commit a3195b1

Please sign in to comment.