Skip to content

Commit 35fa04c

Browse files
committed
Merge branch 'main' of github.com:newrelic/newrelic-python-agent
2 parents 712c9fa + 1e0a131 commit 35fa04c

95 files changed

Lines changed: 40183 additions & 2071 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Copyright 2010 New Relic, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# original source: https://github.com/newrelic/newrelic-agent-control/blob/main/agent-control/agent-type-registry/newrelic/com.newrelic.apm_python-0.1.0.yaml
16+
namespace: newrelic
17+
name: com.newrelic.apm_python
18+
version: 0.1.0
19+
variables:
20+
k8s:
21+
podLabelSelector:
22+
description: "Pod label selector"
23+
type: yaml
24+
default: {}
25+
required: false
26+
containerSelector:
27+
description: "Container selector"
28+
type: yaml
29+
default: {}
30+
required: false
31+
namespaceLabelSelector:
32+
description: "Namespace label selector"
33+
type: yaml
34+
default: {}
35+
required: false
36+
# All 'agent' side-car related variables are flattened.
37+
version:
38+
description: "Python Agent init container version"
39+
type: string
40+
default: "latest"
41+
required: false
42+
env:
43+
description: "environment variables to pass to Python agent"
44+
type: yaml
45+
default: []
46+
required: false
47+
imagePullPolicy:
48+
description: "image pull policy for the Python agent init container"
49+
type: string
50+
default: "Always"
51+
required: false
52+
resourceRequirements:
53+
description: "resource requirements for the Python agent init container"
54+
type: yaml
55+
default: {}
56+
required: false
57+
securityContext:
58+
description: "security context for the Python agent init container"
59+
type: yaml
60+
default: {}
61+
required: false
62+
# All health sidecar related variables are flattened and prefixed with "health_"
63+
health_env:
64+
description: "environment variables to pass to health sidecar"
65+
type: yaml
66+
default: []
67+
required: false
68+
health_version:
69+
description: "health sidecar image version"
70+
type: string
71+
default: "latest"
72+
required: false
73+
health_imagePullPolicy:
74+
description: "image pull policy for the health sidecar"
75+
type: string
76+
default: "Always"
77+
required: false
78+
health_resourceRequirements:
79+
description: "resource requirements for the health sidecar"
80+
type: yaml
81+
default: {}
82+
required: false
83+
health_securityContext:
84+
description: "security context for the health sidecar"
85+
type: yaml
86+
default: {}
87+
required: false
88+
deployment:
89+
k8s:
90+
health:
91+
interval: 30s
92+
initial_delay: 30s
93+
objects:
94+
instrumentation:
95+
apiVersion: newrelic.com/v1beta3
96+
kind: Instrumentation
97+
metadata:
98+
name: ${nr-sub:agent_id}
99+
# APM CRs should be installed in "nr-ac:namespace"
100+
# Due to a limitation in the k8s-agents-operator, Instrumentation CRs must be installed in the same namespace as the operator.
101+
# Hence, the namespace is set to "nr-ac:namespace_agents".
102+
# Reference: https://github.com/newrelic/k8s-agents-operator/blob/92c19208864f051f03f457ee04b772fca5042162/api/v1beta1/instrumentation_webhook.go#L110C27-L110C72
103+
namespace: ${nr-ac:namespace_agents}
104+
spec:
105+
agent:
106+
language: python
107+
image: newrelic/newrelic-python-init:${nr-var:version}
108+
env: ${nr-var:env}
109+
imagePullPolicy: ${nr-var:imagePullPolicy}
110+
resources: ${nr-var:resourceRequirements}
111+
securityContext: ${nr-var:securityContext}
112+
healthAgent:
113+
image: newrelic/k8s-apm-agent-health-sidecar:${nr-var:health_version}
114+
env: ${nr-var:health_env}
115+
imagePullPolicy: ${nr-var:health_imagePullPolicy}
116+
resources: ${nr-var:health_resourceRequirements}
117+
securityContext: ${nr-var:health_securityContext}
118+
podLabelSelector: ${nr-var:podLabelSelector}
119+
namespaceLabelSelector: ${nr-var:namespaceLabelSelector}
120+
containerSelector: ${nr-var:containerSelector}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2010 New Relic, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
agentControlDefinitions:
16+
- platform: KUBERNETESCLUSTER
17+
supportFromAgent: 1.0.0
18+
supportFromAgentControl: 1.0.0
19+
content: ./agentControl/agent-schema-for-agent-control.yml
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2010 New Relic, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
configurationDefinitions:
16+
- platform: KUBERNETESCLUSTER
17+
description: Python agent configuration
18+
type: agent-config
19+
version: 1.0.0
20+
# will add schema information here later

.github/mergify.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pull_request_rules:
2828
conditions:
2929
- merged
3030
actions:
31-
delete_head_branch:
3231
label:
3332
remove:
3433
- "merge-conflicts"
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright 2010 New Relic, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Agent Metadata
16+
17+
permissions:
18+
contents: read
19+
20+
on:
21+
# Allows manual triggering with parameters
22+
workflow_dispatch:
23+
inputs:
24+
version:
25+
description: "Version tag (needs to exactly match the GH tag for the release)"
26+
required: true
27+
type: string
28+
agent-type:
29+
description: "Agent type"
30+
required: false
31+
default: "NRPythonAgent"
32+
type: string
33+
use-cache:
34+
description: "Use cache"
35+
required: false
36+
default: true
37+
type: boolean
38+
39+
# Allows calling from another workflow
40+
workflow_call:
41+
inputs:
42+
version:
43+
description: "Version tag (needs to exactly match the GH tag for the release)"
44+
required: true
45+
type: string
46+
agent-type:
47+
description: "Agent type"
48+
required: false
49+
default: "NRPythonAgent"
50+
type: string
51+
use-cache:
52+
description: "Use cache"
53+
required: false
54+
default: true
55+
type: boolean
56+
secrets:
57+
FC_SYS_ID_CLIENT_ID:
58+
required: true
59+
FC_SYS_ID_PR_KEY:
60+
required: true
61+
APM_CONTROL_NR_LICENSE_KEY_STAGING:
62+
required: false
63+
64+
jobs:
65+
send-agent-metadata:
66+
uses: newrelic/newrelic-agent-init-container/.github/workflows/agent-metadata.yml@main
67+
with:
68+
agent-type: ${{ inputs.agent-type }}
69+
version: ${{ inputs.version }}
70+
use-cache: ${{ inputs.use-cache }}
71+
secrets:
72+
FC_SYS_ID_CLIENT_ID: ${{ secrets.FC_SYS_ID_CLIENT_ID }}
73+
FC_SYS_ID_PR_KEY: ${{ secrets.FC_SYS_ID_PR_KEY }}
74+
APM_CONTROL_NR_LICENSE_KEY_STAGING: ${{ secrets.APM_CONTROL_NR_LICENSE_KEY_STAGING }} # action app is instrumented and supported by APM Control team

.github/workflows/deploy.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,16 @@ jobs:
230230
gh release create "${RELEASE_TAG}" --title="${RELEASE_TITLE}" --repo=newrelic/newrelic-agent-init-container --notes="${RELEASE_NOTES}"
231231
env:
232232
GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}
233+
234+
update-agent-metadata:
235+
needs: [publish]
236+
permissions:
237+
contents: read
238+
uses: ./.github/workflows/agent-metadata.yml
239+
with:
240+
version: ${{ github.ref_name }}
241+
agent-type: "NRPythonAgent"
242+
secrets:
243+
FC_SYS_ID_CLIENT_ID: ${{ secrets.FC_SYS_ID_CLIENT_ID }}
244+
FC_SYS_ID_PR_KEY: ${{ secrets.FC_SYS_ID_PR_KEY }}
245+
APM_CONTROL_NR_LICENSE_KEY_STAGING: ${{ secrets.APM_CONTROL_NR_LICENSE_KEY_STAGING }}

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
coverage xml
114114
115115
- name: Upload Coverage to Codecov
116-
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # 5.5.2
116+
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # 6.0.0
117117
with:
118118
files: coverage.xml
119119
fail_ci_if_error: true
@@ -301,7 +301,7 @@ jobs:
301301
git fetch --tags origin
302302
303303
- name: Install uv
304-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # 7.6.0
304+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # 8.0.0
305305

306306
- name: Install Python
307307
run: |
@@ -370,7 +370,7 @@ jobs:
370370
git fetch --tags origin
371371
372372
- name: Install uv
373-
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # 7.6.0
373+
uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # 8.0.0
374374

375375
- name: Install Python
376376
run: |

.github/workflows/trivy.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ name: Trivy
1616

1717
on:
1818
pull_request:
19+
schedule:
20+
- cron: "0 15 * * *"
1921

2022
concurrency:
2123
group: ${{ github.ref || github.run_id }}-${{ github.workflow }}
@@ -29,6 +31,10 @@ jobs:
2931
trivy:
3032
if: success() || failure() # Does not run on cancelled workflows
3133
runs-on: ubuntu-24.04
34+
permissions:
35+
contents: read
36+
security-events: write
37+
3238
steps:
3339
# Git Checkout
3440
- name: Checkout Code
@@ -61,6 +67,6 @@ jobs:
6167

6268
- name: Upload Trivy scan results to GitHub Security tab
6369
if: ${{ github.event_name == 'schedule' }}
64-
uses: github/codeql-action/upload-sarif@b1bff81932f5cdfc8695c7752dcee935dcd061c8 # 4.33.0
70+
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # 4.35.1
6571
with:
6672
sarif_file: "trivy-results.sarif"

0 commit comments

Comments
 (0)