-
Notifications
You must be signed in to change notification settings - Fork 16
120 lines (112 loc) · 4.73 KB
/
merge_to_main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: Merge to main
on:
push:
branches:
- main
jobs:
get_release_tag:
name: Gets pre-release tag commit associated with the merged PR
runs-on: ubuntu-latest
outputs:
tag: "tmp-pr-${{ steps.get_pr_number.outputs.result }}"
pr_number: "${{ steps.get_pr_number.outputs.result }}"
steps:
- name: Get PR number
uses: actions/github-script@v6
id: get_pr_number
with:
script: |
return (
await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
})
).data[0].number;
result-encoding: string
publish_linux_to_prod:
name: Publish linux packages to production
needs: get_release_tag
runs-on: ubuntu-latest
steps:
- name: Publish linux packages to production
uses: newrelic/infrastructure-publish-action@v1
with:
app_name: fluent-bit
tag: ${{ needs.get_release_tag.outputs.tag }}
repo_name: "newrelic/fluent-bit-package"
schema: "custom"
schema_url: "https://github.com/newrelic/fluent-bit-package/releases/download/${{ needs.get_release_tag.outputs.tag }}/generated-linux-schema-production.yaml"
aws_access_key_id: ${{ secrets.OHAI_AWS_ACCESS_KEY_ID_PRODUCTION }}
aws_secret_access_key: ${{ secrets.OHAI_AWS_SECRET_ACCESS_KEY_PRODUCTION }}
aws_s3_bucket_name: "nr-downloads-main"
aws_s3_lock_bucket_name: "onhost-ci-lock"
access_point_host: "production"
run_id: ${{ github.run_id }}
aws_region: "us-east-1"
aws_role_session_name: ${{ secrets.OHAI_AWS_ROLE_SESSION_NAME_PRODUCTION }}
aws_role_arn: ${{ secrets.OHAI_AWS_ROLE_ARN_PRODUCTION }}
# used for signing package stuff
gpg_passphrase: ${{ secrets.OHAI_GPG_PASSPHRASE }}
gpg_private_key_base64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_BASE64 }} # base64 encoded
run_e2e_tests_production:
needs: [ get_release_tag, publish_linux_to_prod ]
if: |
always() && !failure() && !cancelled()
name: Run E2E tests for all supported packages installing NRIA from production
uses: ./.github/workflows/run_e2e_tests.yml
with:
gh_release_name: ${{ needs.get_release_tag.outputs.tag }}
infra_agent_version: latest
infra_agent_env: production
test_report_filename: test-report-production.xml
secrets: inherit
publish_windows:
name: Publish windows packages to logging's production bucket
needs: get_release_tag
uses: ./.github/workflows/run_task.yml
with:
container_make_target: "ansible/upload-win-packages/run PR_TAG=${{ needs.get_release_tag.outputs.tag }}"
secrets: inherit
promote_prerelease_to_release:
name: If there are packages in the pre_release, promote it to release
needs: [ get_release_tag, run_e2e_tests_production ]
runs-on: ubuntu-latest
outputs:
is_release: "${{ steps.promote_to_release.outputs.is_release }}"
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check if pre_release has artifacts, if so, upgrade to release
id: promote_to_release
run: |
PR_NUMBER=${{ needs.get_release_tag.outputs.pr_number }}
TAG=${{ needs.get_release_tag.outputs.tag }}
PKG_COUNT=$(gh release view $TAG --repo newrelic/fluent-bit-package --json assets --jq '.assets[].name' | grep -E '^(fb-windows|fluent-bit)' | wc -l)
if [[ $PKG_COUNT -gt 0 ]]
then
gh release edit $TAG --draft=false --prerelease=false --title "Release $PR_NUMBER"
echo "is_release=true" >> $GITHUB_OUTPUT
fi
notify:
runs-on: ubuntu-latest
needs: [ get_release_tag, promote_prerelease_to_release ]
if: ${{ needs.promote_prerelease_to_release.outputs.is_release == 'true' }}
steps:
- name: Send release details to Slack workflow
id: slack
uses: slackapi/slack-github-action@v1
with:
payload: |
{
"releaseUrl": "https://github.com/newrelic/fluent-bit-package/releases/tag/${{ needs.get_release_tag.outputs.tag }}",
"releaseName": "${{ needs.get_release_tag.outputs.tag }}",
"productName": "${{ env.PRODUCT_NAME }}",
"productUrl": "${{ env.PRODUCT_URL }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
PRODUCT_NAME: Fluent Bit packages for the New Relic Infrastructure Agent
PRODUCT_URL: https://docs.newrelic.com/docs/logs/forward-logs/forward-your-logs-using-infrastructure-agent