Skip to content

Commit 7560ae9

Browse files
committed
feat: add chef install test
1 parent 56589cc commit 7560ae9

File tree

2 files changed

+93
-15
lines changed

2 files changed

+93
-15
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Chef_install_test
2+
3+
on:
4+
workflow_dispatch:
5+
# schedule:
6+
# Scheduled to run at 6 a.m on mondays.
7+
#- cron: "0 6 * * 1"
8+
push:
9+
10+
jobs:
11+
chef-install:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
18+
- name: Set up and execute Chef installation
19+
run: |
20+
set -e # Exit immediately if a command exits with a non-zero status
21+
22+
# Download and install Cinc (Chef)
23+
curl -L https://omnitruck.cinc.sh/install.sh | sudo bash
24+
25+
# Download and unpack newrelic-install cookbook
26+
wget https://supermarket.chef.io/cookbooks/newrelic-install/download -O newrelic-install.tar.gz
27+
mkdir cookbooks
28+
tar -xzf newrelic-install.tar.gz -C cookbooks/.
29+
30+
- name: Edit and install Chef recipe
31+
run: |
32+
# Edit Chef newrelic-install default attributes file with required fields
33+
cat <<EOF > cookbooks/newrelic-install/attributes/default.rb
34+
default['newrelic_install']['NEW_RELIC_API_KEY'] = '${{ secrets.AC_PROD_E2E_API_KEY }}'
35+
default['newrelic_install']['NEW_RELIC_ACCOUNT_ID'] = '${{ secrets.AC_PROD_E2E_ACCOUNT_ID }}'
36+
default['newrelic_install']['NEW_RELIC_REGION'] = 'US'
37+
default['newrelic_install']['targets'] = [
38+
'logs-integration-agent-control',
39+
'agent-control'
40+
]
41+
default['newrelic_install']['env']['NEW_RELIC_CLI_SKIP_CORE'] = '1'
42+
default['newrelic_install']['env']['NEW_RELIC_AUTH_CLIENT_ID']='${{ secrets.AC_PROD_E2E_NR_SYSTEM_IDENTITY_CLIENT_ID }}'
43+
default['newrelic_install']['env']['NEW_RELIC_AUTH_CLIENT_PRIVATE_KEY']='${{ secrets.AC_PROD_E2E_NR_SYSTEM_IDENTITY_PRIVATE_KEY }}'
44+
default['newrelic_install']['env']['NR_CLI_FLEET_ID']='MTIyMTMwNjh8TkdFUHxGTEVFVHwwMTk1ZDE1NC1iNTI0LTdhMTYtYWExYS0wYzQ2Y2VhOGFiMzg'
45+
default['newrelic_install']['env']['NEW_RELIC_AGENT_CONTROL_HOST_MONITORING_SOURCE']='infra-agent'
46+
default['newrelic_install']['env']['NEW_RELIC_AGENT_CONTROL_PROXY_URL']=''
47+
default['newrelic_install']['env']['NEW_RELIC_AGENT_CONTROL_PROXY_CA_BUNDLE_DIR']=''
48+
default['newrelic_install']['env']['NEW_RELIC_AGENT_CONTROL_PROXY_CA_BUNDLE_FILE']=''
49+
default['newrelic_install']['env']['NEW_RELIC_AGENT_CONTROL_PROXY_IGNORE_SYSTEM']='false'
50+
EOF
51+
52+
# Execute newrelic install
53+
sudo chef-client --local-mode --runlist 'recipe[newrelic-install::default]'
54+
55+
- name: Check for successful installation
56+
run: |
57+
if grep -qE "Agent Control\s*\(installed\)" output.log; then
58+
echo "Installation successful: Agent Control is installed."
59+
else
60+
echo "Installation failed: Agent Control is not installed."
61+
exit 1
62+
fi
63+
64+
# notify-failure:
65+
# if: ${{ always() && failure() }}
66+
# needs: [puppet-install]
67+
# runs-on: ubuntu-latest
68+
# steps:
69+
# - name: Notify failure via Slack
70+
# uses: slackapi/slack-github-action@v1.22.0
71+
# with:
72+
# payload: |
73+
# {
74+
# "text": ":warning: [Puppet installation workflow failed] @hero check <${{ env.GITHUB_JOB_URL }}>"
75+
# }
76+
# env:
77+
# SLACK_WEBHOOK_URL: ${{ secrets.AC_SLACK_WEBHOOK }}
78+
# GITHUB_JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

.github/workflows/puppet_install_test.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ jobs:
7373
exit 1
7474
fi
7575
76-
notify-failure:
77-
if: ${{ always() && failure() }}
78-
needs: [puppet-install]
79-
runs-on: ubuntu-latest
80-
steps:
81-
- name: Notify failure via Slack
82-
uses: slackapi/slack-github-action@v1.22.0
83-
with:
84-
payload: |
85-
{
86-
"text": ":warning: [Puppet installation workflow failed] @hero check <${{ env.GITHUB_JOB_URL }}>"
87-
}
88-
env:
89-
SLACK_WEBHOOK_URL: ${{ secrets.AC_SLACK_WEBHOOK }}
90-
GITHUB_JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
76+
# notify-failure:
77+
# if: ${{ always() && failure() }}
78+
# needs: [puppet-install]
79+
# runs-on: ubuntu-latest
80+
# steps:
81+
# - name: Notify failure via Slack
82+
# uses: slackapi/slack-github-action@v1.22.0
83+
# with:
84+
# payload: |
85+
# {
86+
# "text": ":warning: [Puppet installation workflow failed] @hero check <${{ env.GITHUB_JOB_URL }}>"
87+
# }
88+
# env:
89+
# SLACK_WEBHOOK_URL: ${{ secrets.AC_SLACK_WEBHOOK }}
90+
# GITHUB_JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

0 commit comments

Comments
 (0)