feat: put right credentials to chef, puppet and ansible tests #23
Workflow file for this run
This file contains hidden or 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: Chef_install_test | |
| on: | |
| workflow_dispatch: | |
| # schedule: | |
| # Scheduled to run at 6 a.m on mondays. | |
| #- cron: "0 6 * * 1" | |
| push: | |
| jobs: | |
| chef-install: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Set up and execute Chef installation | |
| run: | | |
| set -e # Exit immediately if a command exits with a non-zero status | |
| # Download and install Cinc (Chef) | |
| curl -L https://omnitruck.cinc.sh/install.sh | sudo bash | |
| # Download and unpack newrelic-install cookbook | |
| wget https://supermarket.chef.io/cookbooks/newrelic-install/download -O newrelic-install.tar.gz | |
| mkdir cookbooks | |
| tar -xzf newrelic-install.tar.gz -C cookbooks/. | |
| - name: Create system identity file | |
| run: | | |
| DEST_DIR="/tmp/newrelic-agent-control" | |
| DEST_FILE="$DEST_DIR/priv.key" | |
| if [ ! -d "$DEST_DIR" ]; then | |
| mkdir -p "$DEST_DIR" | |
| fi | |
| echo "${{ secrets.AC_PROD_E2E_NR_SYSTEM_IDENTITY_PRIVATE_KEY }}" > "$DEST_FILE" | |
| - name: Edit and install Chef recipe | |
| run: | | |
| # Edit Chef newrelic-install default attributes file with required fields | |
| sed -i '/curl -Ls https:\/\/download.newrelic.com\/install\/newrelic-cli\/scripts\/install.sh/{s/newrelic install/newrelic install --debug/}' cookbooks/newrelic-install/resources/newrelic_install.rb | |
| cat <<EOF > cookbooks/newrelic-install/attributes/default.rb | |
| default['newrelic_install']['NEW_RELIC_API_KEY'] = '${{ secrets.AC_PROD_E2E_API_KEY }}' | |
| default['newrelic_install']['NEW_RELIC_ACCOUNT_ID'] = '${{ secrets.AC_PROD_E2E_ACCOUNT_ID }}' | |
| default['newrelic_install']['NEW_RELIC_REGION'] = 'US' | |
| default['newrelic_install']['targets'] = [ | |
| 'logs-integration-agent-control', | |
| 'agent-control' | |
| ] | |
| default['newrelic_install']['env']['NEW_RELIC_CLI_SKIP_CORE'] = '1' | |
| default['newrelic_install']['env']['NEW_RELIC_AUTH_PROVISIONED_CLIENT_ID']='${{ secrets.AC_PROD_E2E_NR_SYSTEM_IDENTITY_CLIENT_ID }}' | |
| default['newrelic_install']['env']['NEW_RELIC_AUTH_PRIVATE_KEY_PATH']='/tmp/newrelic-agent-control/priv.key' | |
| default['newrelic_install']['env']['NR_CLI_FLEET_ID']='NjQyNTg2NXxOR0VQfEZMRUVUfDAxOTkyOGQyLTg3OTAtNzJlNC05ODgwLTJhYzE0NTRlZDUyZg' | |
| default['newrelic_install']['env']['NEW_RELIC_AGENT_CONTROL_HOST_MONITORING_SOURCE']='infra-agent' | |
| default['newrelic_install']['env']['NEW_RELIC_AGENT_CONTROL_PROXY_URL']='' | |
| default['newrelic_install']['env']['NEW_RELIC_AGENT_CONTROL_PROXY_CA_BUNDLE_DIR']='' | |
| default['newrelic_install']['env']['NEW_RELIC_AGENT_CONTROL_PROXY_CA_BUNDLE_FILE']='' | |
| default['newrelic_install']['env']['NEW_RELIC_AGENT_CONTROL_PROXY_IGNORE_SYSTEM']='false' | |
| EOF | |
| # Execute newrelic install | |
| sudo chef-client --local-mode --runlist 'recipe[newrelic-install::default]' | |
| sudo chef-client --local-mode --runlist 'recipe[newrelic-install::default]' > output.log 2>&1 | |
| - name: Check for successful installation | |
| run: | | |
| if grep -qE "Agent Control\s*\(installed\)" output.log; then | |
| echo "Installation successful: Agent Control is installed." | |
| else | |
| echo "Installation failed: Agent Control is not installed." | |
| exit 1 | |
| fi | |
| # notify-failure: | |
| # if: ${{ always() && failure() }} | |
| # needs: [chef-install] | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: Notify failure via Slack | |
| # uses: slackapi/slack-github-action@v1.22.0 | |
| # with: | |
| # payload: | | |
| # { | |
| # "text": ":warning: [Chef installation workflow failed] @hero check <${{ env.GITHUB_JOB_URL }}>" | |
| # } | |
| # env: | |
| # SLACK_WEBHOOK_URL: ${{ secrets.AC_SLACK_WEBHOOK }} | |
| # GITHUB_JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |