This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
Merge pull request #116 from newrelic/archive-notice #601
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
name: UatGcp | |
on: [push, pull_request] | |
jobs: | |
test-cloudprovider-gcp: | |
runs-on: ubuntu-latest | |
if: always() && github.event_name == 'push' | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
- name: Write GCP files | |
env: | |
UAT_GCP_PEM_FILE: ${{ secrets.UAT_GCP_PEM_FILE }} | |
UAT_GCP_SERVICEACCOUNT_FILE: ${{ secrets.UAT_GCP_SERVICEACCOUNT_FILE }} | |
run: | | |
rm -f $GITHUB_WORKSPACE/configs/compute-user.pem | |
echo "$UAT_GCP_PEM_FILE" > $GITHUB_WORKSPACE/configs/compute-user.pem | |
sudo chmod 400 $GITHUB_WORKSPACE/configs/compute-user.pem | |
rm -f $GITHUB_WORKSPACE/configs/demo-newrelic-staging-gcp-service-account.json | |
echo "$UAT_GCP_SERVICEACCOUNT_FILE" > $GITHUB_WORKSPACE/configs/demo-newrelic-staging-gcp-service-account.json | |
- name: Write UAT JSON to file | |
env: | |
UAT_JSON: ${{ secrets.UAT_USER_GCP }} | |
run: | | |
echo "$UAT_JSON" > user_acceptance_tests/gcp/uat${{ github.run_id }}.json.local | |
- name: Build the docker image | |
run: docker build -t deployer . | |
- name: Cloud Provider Tests (GCP) | |
run: docker run -i --entrypoint bundle deployer exec rake test:uat:gcp | |
slack-notify: | |
runs-on: ubuntu-latest | |
needs: [test-cloudprovider-gcp] | |
if: always() && github.event_name == 'push' | |
steps: | |
- name: Build Result Slack Notification | |
uses: 8398a7/action-slack@v3 | |
with: | |
author_name: GitHub Actions | |
status: custom | |
fields: commit,repo,ref,author,eventName,message,workflow | |
custom_payload: | | |
{ | |
username: "GitHub Actions", | |
icon_emoji: ":octocat:", | |
attachments: [{ | |
color: ${{ | |
needs.test-cloudprovider-gcp.result == 'success' | |
}} === true ? '#43cc11' : '#e05d44', | |
blocks: [ | |
{ | |
type: "section", | |
text: { | |
type: "mrkdwn", | |
text: `Build for ${process.env.AS_REPO}` | |
} | |
}, | |
{ | |
type: "section", | |
fields: [ | |
{ | |
type: "mrkdwn", | |
text: `*Commit:*\n${process.env.AS_COMMIT}` | |
}, | |
{ | |
type: "mrkdwn", | |
text: `*Author:*\n${process.env.AS_AUTHOR}` | |
}, | |
{ | |
type: "mrkdwn", | |
text: `*Branch:*\n${process.env.AS_REF}` | |
}, | |
{ | |
type: "mrkdwn", | |
text: `*Message:*\n${process.env.AS_MESSAGE}` | |
}, | |
{ | |
type: "mrkdwn", | |
text: `*Type:*\n${process.env.AS_EVENT_NAME}` | |
}, | |
{ | |
type: "mrkdwn", | |
text: "*PR:*\n${{ github.event.pull_request.html_url }}" | |
}, | |
{ | |
type: "mrkdwn", | |
text: `*Workflow:*\n${ process.env.AS_WORKFLOW }` | |
} | |
] | |
}, | |
{ | |
type: "section", | |
text: { | |
type: "mrkdwn", | |
text: [ | |
"*Result:*", | |
`• ${ ${{ needs.test-cloudprovider-gcp.result == 'success' }} === true ? '✅' : '❌' } GCP cloud provider test: ${{ needs.test-cloudprovider-gcp.result }}` | |
].join('\n') | |
} | |
}, | |
{ | |
type: "context", | |
elements: [ | |
{ | |
type: "image", | |
image_url: "https://avatars2.githubusercontent.com/in/15368", | |
alt_text: "Github Actions" | |
}, | |
{ | |
type: "mrkdwn", | |
text: "This message was created automatically by GitHub Actions." | |
} | |
] | |
} | |
] | |
}] | |
} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |