-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c8b792
commit 54c31bd
Showing
13 changed files
with
312 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
name: Publish CSEC Agent to central | ||
description: Builds the CSEC Agent and the Agent API. Publish to central maven repo via sonatype. | ||
inputs: | ||
sonatype-username: | ||
description: 'Sonatype repo access username' | ||
required: true | ||
default: '' | ||
sonatype-password: | ||
description: 'Sonatype repo access password' | ||
required: true | ||
default: '' | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Publish CSEC agent API locally | ||
shell: bash | ||
run: ./gradlew $GRADLE_OPTIONS :newrelic-security-api:publish | ||
run: ./gradlew $GRADLE_OPTIONS :newrelic-security-api:publish -PbuildNumber=${{ github.run_id }} -PcommitId=${{ github.sha }} --parallel | ||
env: | ||
SONATYPE_USERNAME: ${{ inputs.sonatype-username }} | ||
SONATYPE_PASSWORD: ${{ inputs.sonatype-password }} | ||
# ORG_GRADLE_PROJECT_signingKey: ${{ inputs.SIGNING_KEY }} | ||
# ORG_GRADLE_PROJECT_signingKeyId: ${{ inputs.SIGNING_KEY_ID }} | ||
# ORG_GRADLE_PROJECT_signingPassword: ${{ inputs.SIGNING_PASSWORD }} | ||
|
||
- name: Publish CSEC agent locally | ||
shell: bash | ||
run: ./gradlew $GRADLE_OPTIONS publish | ||
run: ./gradlew $GRADLE_OPTIONS publish -PbuildNumber=${{ github.run_id }} -PcommitId=${{ github.sha }} --parallel | ||
env: | ||
SONATYPE_USERNAME: ${{ inputs.sonatype-username }} | ||
SONATYPE_PASSWORD: ${{ inputs.sonatype-password }} | ||
# ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | ||
# ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} | ||
# ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Send slack notification | ||
description: Send slack notification to configured webhook. | ||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Publish CSEC agent API locally | ||
shell: bash | ||
run: ./gradlew $GRADLE_OPTIONS :newrelic-security-api:publish --parallel | ||
|
||
- name: Publish CSEC agent locally | ||
shell: bash | ||
run: ./gradlew $GRADLE_OPTIONS publish --parallel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,23 +2,39 @@ name: Create Integrated Agent jar | |
on: | ||
workflow_dispatch: | ||
inputs: | ||
agent-ref: | ||
description: "Specify branch/tag/hash" | ||
source-ref: | ||
description: "Specify source-ref/tag/hash" | ||
required: true | ||
default: 'github-actions' | ||
apm-repo: | ||
description: 'The repo of APM source code to use' | ||
required: true | ||
default: 'newrelic/newrelic-java-agent' | ||
apm-branch: | ||
description: 'The branch of APM source code to use' | ||
apm-source-ref: | ||
description: 'The source-ref of APM source code to use' | ||
required: true | ||
default: 'k2-integration-build' | ||
default: 'k2-integration' | ||
csec-run-unittest: | ||
description: 'Whether to run CSEC instrumentation unit tests' | ||
required: true | ||
default: true | ||
csec-run-instrumentation-verify: | ||
description: 'Whether to run CSEC instrumentation verifier' | ||
required: true | ||
default: true | ||
slack-notify: | ||
description: 'Whether to notify build status on slack' | ||
required: true | ||
default: true | ||
description: | ||
description: "A description for the custom jar that will be generated. It will appear in the summary." | ||
required: true | ||
default: 'test' | ||
|
||
permissions: | ||
id-token: write # This is required for requesting the JWT | ||
contents: read # This is required for actions/checkout | ||
|
||
jobs: | ||
create_integrated_jar: | ||
name: Create Integrated Agent jar | ||
|
@@ -28,29 +44,48 @@ jobs: | |
- name: Checkout CSEC Java agent | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.agent-ref }} | ||
|
||
- name: Configure AWS Credentials | ||
if: ${{ env.AWS_KEY != '' }} | ||
uses: aws-actions/configure-aws-credentials@v1-node16 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-2 | ||
ref: ${{ inputs.source-ref }} | ||
|
||
- name: Setup environment | ||
uses: ./.github/actions/setup-environment | ||
with: | ||
apm-repo: ${{ inputs.apm-repo }} | ||
apm-branch: ${{ inputs.apm-branch }} | ||
apm-branch: ${{ inputs.apm-source-ref }} | ||
apm-aws-access-key-id: ${{ secrets.APM_AWS_ACCESS_KEY_ID }} | ||
apm-aws-secret-access-key: ${{ secrets.APM_AWS_SECRET_ACCESS_KEY }} | ||
apm-aws-region: us-east-2 | ||
|
||
- name: Run CSEC unit tests | ||
uses: ./.github/actions/unit-test | ||
- name: Check version compatibility | ||
shell: bash | ||
run: | | ||
APM_CONFIGURED_CSEC_VERSION=$(./gradlew -p newrelic-java-agent/ properties ${BUILD_PROPS} | grep 'csecCollectorVersion:' | awk -F': ' '{print $2}') | ||
CSEC_CONFIGURED_APM_VERSION=$(./gradlew properties ${BUILD_PROPS}| grep 'nrAPIVersion:' | awk -F': ' '{print $2}') | ||
if [[ "${APM_VERSION}" != "${CSEC_CONFIGURED_APM_VERSION}" ]] | ||
then | ||
printf "${RED}Version mismatch regarding APM: ${NONE}\n" | ||
printf "${RED}Version of APM to build: ${APM_VERSION} ${NONE}\n" | ||
printf "${RED}Version of APM API used by CSEC: ${CSEC_CONFIGURED_APM_VERSION} ${NONE}\n" | ||
exit 1 | ||
fi | ||
if [[ "${SECURITY_VERSION}" != "${APM_CONFIGURED_CSEC_VERSION}" ]] | ||
then | ||
printf "${RED}Version mismatch regarding Security: ${NONE}\n" | ||
printf "${RED}Version of CSEC to build: ${SECURITY_VERSION} ${NONE}\n" | ||
printf "${RED}Version of CSEC API used by APM: ${APM_CONFIGURED_CSEC_VERSION} ${NONE}\n" | ||
exit 2 | ||
fi | ||
- name: Publish CSEC to local | ||
uses: ./.github/actions/publish-csec-local | ||
|
||
- name: Run CSEC unit tests | ||
if: ${{ inputs.csec-run-unittest == 'true' }} | ||
uses: ./.github/actions/unit-test | ||
|
||
- name: Verify CSEC instrumentation | ||
if: ${{ inputs.csec-run-instrumentation-verify == 'true' }} | ||
uses: ./.github/actions/verify-instrumentation | ||
|
||
- name: Build Integrated Agent Jar | ||
|
@@ -59,4 +94,27 @@ jobs: | |
- name: Set summary | ||
run: | | ||
echo "${{ inputs.description }}" >> $GITHUB_STEP_SUMMARY | ||
echo "This jar was built from the ref (branch/tag/hash): ${{ inputs.ref }}." >> $GITHUB_STEP_SUMMARY | ||
echo "This jar was built from the ref (source-ref/tag/hash): ${{ inputs.source-ref }}." >> $GITHUB_STEP_SUMMARY | ||
- name: Send slack notification | ||
uses: slackapi/[email protected] | ||
if: ${{ inputs.slack-notify == 'true' }} | ||
with: | ||
payload: | | ||
{ | ||
"task": "Integrated jar build", | ||
"job-ref": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}", | ||
"build-number": "${{ github.run_id }}-${{ github.run_number }}", | ||
"apm-full-ref": "${{ github.server_url }}/${{ inputs.apm-repo }}/tree/${{ inputs.apm-source-ref }}", | ||
"apm-source-ref": "${{ inputs.apm-source-ref }}", | ||
"apm-version": "${{ env.APM_VERSION }}", | ||
"security-full-ref": "${{ github.server_url }}/${{ github.repository }}/tree/${{ inputs.source-ref }}", | ||
"security-source-ref": "${{ inputs.source-ref }}", | ||
"security-version": "${{ env.SECURITY_VERSION }}", | ||
"security-json-version": "${{ env.SECURITY_JSON_VERSION }}", | ||
"changelog-url": "${{ github.server_url }}/${{ github.repository }}/blob/${{ inputs.source-ref }}/Changelog.md", | ||
"custom-message": "${{ inputs.description }}", | ||
"artifact-download-link": "https://nr-java-sec-agent.s3.us-west-2.amazonaws.com/integrated-builds/${{ github.run_id }}-${{ github.run_number }}/newrelic.zip" | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
Oops, something went wrong.