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

Promote to PROD #138

Merged
merged 2 commits into from
Jun 18, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
# Please look up the latest version from
# https://github.com/amannn/action-semantic-pull-request/releases
- uses: amannn/action-semantic-pull-request@7bfb19c48fc334d3dacb072cf982e81535041209
- uses: amannn/action-semantic-pull-request@cfb60706e18bc85e8aec535e3c577abe8f70378e # v5.5.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
persist-credentials: false
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
scope: 'cycjimmy'
- name: Release
uses: cycjimmy/semantic-release-action@61680d0e9b02ff86f5648ade99e01be17f0260a4 #v4.0.0
uses: cycjimmy/semantic-release-action@cb425203a562475bca039ba4dbf90c7f9ac790f4 # v4.1.0
with:
semantic_version: 18.0.0
extra_plugins: |
semantic-release/release-notes-generator#5f9d65debbb60057c0d35d3a198e41f5bf09cf0f
semantic-release/release-notes-generator#fff490d209c7bb69b71bd704cd19d0363eeca4ff
semantic-release/git#3e934d45f97fd07a63617c0fc098c9ed3e67d97a
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53 changes: 20 additions & 33 deletions .github/workflows/cve-scan.yml → .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# and parameters, see https://github.com/anchore/scan-action. For more
# information on Anchore's container image scanning tool Grype, see
# https://github.com/anchore/grype
name: CVE Container Scan
name: Container Scan

on:
push:
Expand All @@ -27,27 +27,30 @@ env:
DOCKERFILE: Dockerfile.native

jobs:
Trivy-Build-Scan:
BuildAndScan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
runs-on: ubuntu-latest
environment: dev
outputs:
CVE_CRITICAL: ${{env.CVE_CRITICAL}}
CVE_HIGH: ${{env.CVE_HIGH}}
CVE_MEDIUM: ${{env.CVE_MEDIUM}}
steps:
- name: Checkout the code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Build the Docker image
run: docker build . --file ${{ env.DOCKERFILE }} --target cve --tag localbuild/testimage:latest
- name: Run the Trivy scan action itself with GitHub Advanced Security code scanning integration enabled
id: scan
uses: aquasecurity/trivy-action@062f2592684a31eb3aa050cc61e7ca1451cecd3d #v0.18.0
uses: aquasecurity/trivy-action@595be6a0f6560a0a8fc419ddf630567fc623531d # v0.22.0
with:
image-ref: "localbuild/testimage:latest"
format: 'sarif'
output: 'results.sarif'
- name: Upload Anchore Scan Report
uses: github/codeql-action/upload-sarif@6c089f53dd51dc3fc7e599c3cb5356453a52ca9e #v2.20.0
uses: github/codeql-action/upload-sarif@9550da953dd3b29aedf76cd635101e48eae5eebd # CodeQL Bundle v2.17.4
with:
sarif_file: 'results.sarif'
- name: CVE Description escaped extraction and print
Expand All @@ -62,30 +65,14 @@ jobs:
id: cve-threshold
if: env.CVE_HIGH > 0 || env.CVE_CRITICAL > 0
run: exit 1
- name: Send notification to Slack
id: slack
if: always() && github.event_name == 'schedule' && steps.cve-threshold.outcome == 'failure'
uses: slackapi/slack-github-action@e28cf165c92ffef168d23c5c9000cffc8a25e117 #v1.24.0
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "[ ${{ github.event.repository.name }} ]"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": " `CRITICAL` : *${{ env.CVE_CRITICAL }}*\n\n`HIGH` : *${{ env.CVE_HIGH }}*\n\n`MEDIUM` : *${{ env.CVE_MEDIUM }}*\n\n<https://github.com/${{ github.repository }}/security/code-scanning |See details on GitHub>"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.CVE_SCAN_SLACK_WEBHOOK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

SendSlackNotification:
needs: BuildAndScan
uses: ./.github/workflows/send-notification.yml
if: github.event_name == 'schedule' && needs.BuildAndScan.steps.cve-threshold.outcome == 'failure'
with:
CVE_CRITICAL: ${{needs.BuildAndScan.outputs.CVE_CRITICAL}}
CVE_HIGH: ${{needs.BuildAndScan.outputs.CVE_HIGH}}
CVE_MEDIUM: ${{needs.BuildAndScan.outputs.CVE_MEDIUM}}
secrets: inherit

50 changes: 50 additions & 0 deletions .github/workflows/send-notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "Send notification"

on:
workflow_call:
inputs:
CVE_CRITICAL:
required: true
type: string
CVE_HIGH:
required: true
type: string
CVE_MEDIUM:
required: true
type: string
secrets:
CVE_SCAN_SLACK_WEBHOOK:
required: true

jobs:
Notify:
name: Notify Slack
runs-on: ubuntu-latest
environment: dev
steps:
- name: Send notification to Slack
id: slack
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e #v1.26.0
with:
payload: |
{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "[ ${{ github.event.repository.name }} ]"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": " `CRITICAL` : *${{ inputs.CVE_CRITICAL }}*\n\n`HIGH` : *${{ inputs.CVE_HIGH }}*\n\n`MEDIUM` : *${{ inputs.CVE_MEDIUM }}*\n\n<https://github.com/${{ github.repository }}/security/code-scanning |See details on GitHub>"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.CVE_SCAN_SLACK_WEBHOOK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
5 changes: 3 additions & 2 deletions Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ COPY . .

RUN ./mvnw clean package -Pnative -DskipTests

FROM ubuntu:noble-20240225@sha256:723ad8033f109978f8c7e6421ee684efb624eb5b9251b70c6788fdb2405d050b AS cve
FROM ubuntu:noble-20240530@sha256:e3f92abc0967a6c19d0dfa2d55838833e947b9d74edbcb0113e48535ad4be12a AS cve
COPY --from=builder /build/target/rtd-ms-sender-auth*.jar .

FROM ubuntu:noble-20240225@sha256:723ad8033f109978f8c7e6421ee684efb624eb5b9251b70c6788fdb2405d050b AS runtime
FROM ubuntu:noble-20240530@sha256:e3f92abc0967a6c19d0dfa2d55838833e947b9d74edbcb0113e48535ad4be12a AS runtime

EXPOSE 8080

Expand All @@ -18,3 +18,4 @@ USER 10000
COPY --from=builder /build/target/rtd-ms-sender-auth .

ENTRYPOINT ["./rtd-ms-sender-auth"]

8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.5</version>
<version>3.3.0</version>
<relativePath/>
</parent>
<groupId>it.gov.pagopa.rtd.ms</groupId>
Expand Down Expand Up @@ -69,19 +69,19 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.19.7</version>
<version>1.19.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>1.19.7</version>
<version>1.19.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mongodb</artifactId>
<version>1.19.7</version>
<version>1.19.8</version>
<scope>test</scope>
</dependency>

Expand Down
Loading