Skip to content

Commit 56589cc

Browse files
committed
feat: add puppet install test
1 parent af2d5e4 commit 56589cc

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Puppet_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+
puppet-install:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
18+
- name: Set up Puppet
19+
run: |
20+
set -e # Exit immediately if a command exits with a non-zero status
21+
22+
# Download and install Puppet release package
23+
wget https://apt.puppet.com/puppet8-release-jammy.deb
24+
sudo dpkg -i puppet8-release-jammy.deb
25+
26+
# Update package list and install Puppet agent
27+
sudo apt update
28+
sudo apt -y install puppet-agent
29+
30+
# Verify Puppet installation
31+
/opt/puppetlabs/bin/puppet --version
32+
33+
- name: Install New Relic Puppet module
34+
run: |
35+
# Install New Relic Puppet module
36+
sudo /opt/puppetlabs/bin/puppet module install newrelic-newrelic_installer --modulepath /etc/puppet/modules
37+
38+
- name: Create and apply Puppet catalog
39+
run: |
40+
# Create Puppet catalog file
41+
cat <<EOF > nr.pp
42+
class { 'newrelic_installer::install':
43+
targets => [
44+
'logs-integration-agent-control',
45+
'agent-control'
46+
],
47+
# See all available targets at: https://github.com/newrelic/puppet-install
48+
environment_variables => {
49+
"NEW_RELIC_API_KEY" => "${{ secrets.AC_PROD_E2E_API_KEY }}",
50+
"NEW_RELIC_ACCOUNT_ID" => "${{ secrets.AC_PROD_E2E_ACCOUNT_ID }}",
51+
"NEW_RELIC_REGION" => "US",
52+
"NEW_RELIC_CLI_SKIP_CORE" => "true",
53+
"NR_CLI_FLEET_ID" => "MTIyMTMwNjh8TkdFUHxGTEVFVHwwMTk1ZDE1NC1iNTI0LTdhMTYtYWExYS0wYzQ2Y2VhOGFiMzg",
54+
"NEW_RELIC_AUTH_CLIENT_ID" => "${{ secrets.AC_PROD_E2E_NR_SYSTEM_IDENTITY_CLIENT_ID }}",
55+
"NEW_RELIC_AUTH_CLIENT_PRIVATE_KEY" => "${{ secrets.AC_PROD_E2E_NR_SYSTEM_IDENTITY_PRIVATE_KEY }}",
56+
"NEW_RELIC_AGENT_CONTROL_HOST_MONITORING_SOURCE" => "infra-agent",
57+
"NEW_RELIC_AGENT_CONTROL_PROXY_URL" => "",
58+
"NEW_RELIC_AGENT_CONTROL_PROXY_CA_BUNDLE_DIR" => "",
59+
"NEW_RELIC_AGENT_CONTROL_PROXY_CA_BUNDLE_FILE" => "",
60+
"NEW_RELIC_AGENT_CONTROL_PROXY_IGNORE_SYSTEM" => "false"
61+
}
62+
}
63+
EOF
64+
65+
sudo /opt/puppetlabs/bin/puppet apply nr.pp --modulepath=/etc/puppet/modules --debug | tee output.log
66+
67+
- name: Check for successful installation
68+
run: |
69+
if grep -qE "Agent Control\s*\(installed\)" output.log; then
70+
echo "Installation successful: Agent Control is installed."
71+
else
72+
echo "Installation failed: Agent Control is not installed."
73+
exit 1
74+
fi
75+
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)