diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index c4444415b..93c82c0a3 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -17,11 +17,17 @@ jobs: update_version: name: Update Version runs-on: macos-latest + permissions: + contents: write # Allows pushing changes to the repository + issues: write # Allows creating issues + packages: write # Allows accessing and publishing packages + pull-requests: write # Allows creating and managing pull requests + actions: write # Allows updating GitHub Action workflows steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: - token: ${{ secrets.GH_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Increase Version run: | version=$(cat ./version | grep -o -e '[0-9]\{1,2\}\.[0-9]\{1,2\}\.[0-9]\{1,2\}') @@ -61,9 +67,16 @@ jobs: name: Create Release runs-on: ubuntu-latest needs: update_version + permissions: + contents: write # Allows pushing changes to the repository + issues: write # Allows creating issues + packages: write # Allows accessing and publishing packages + pull-requests: write # Allows creating and managing pull requests + actions: write # Allows updating GitHub Action workflows + attestations: write # Allows adding and updating artifact attestations steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Update version file run: | echo "${{ needs.update_version.outputs.VERSION }}" >./version diff --git a/config-templates/helm.json b/config-templates/helm.json index 52fed543f..ce0478944 100644 --- a/config-templates/helm.json +++ b/config-templates/helm.json @@ -24,8 +24,14 @@ }, { "template": " --set metricsOrTraces.enabled=true \\", - "targetElement": "datasources[?(@.name=='Kubernetes')].telemetries[?(@.type=='METRICS' || @.type=='TRACING')]" - }, + "targetElement": "datasources[?(@.name=='Kubernetes')].telemetries[?(@.type=='METRICS' || @.type=='TRACING')]", + "conditionalTemplates": [ + { + "condition": "(datasources[?(@.name=='Kubernetes')].telemetries[?(@.type=='METRICS')]) && datasources[?(@.name=='Kubernetes')].telemetries[?(@.type=='METRICS')].params[?(@.name=='isObjectLogs')].value)", + "template": " --set logzio-k8s-telemetry.secrets.LogzioRegion='<>' \\" + } + ] + }, { "template": " --set logzio-k8s-telemetry.metrics.enabled=true \\", "targetElement": "datasources[?(@.name=='Kubernetes')].telemetries[?(@.type=='METRICS')]", @@ -85,9 +91,6 @@ "template": " --set logzio-k8s-telemetry.secrets.k8sObjectsLogsToken='<>' \\", "targetElement": "datasources[?(@.name=='Kubernetes')].telemetries[?(@.type=='METRICS')].params[?(@.name=='isObjectLogs')].value" - }, - { - "template": " --set logzio-k8s-telemetry.secrets.LogzioRegion='<>' \\" } ] }, @@ -98,9 +101,6 @@ { "template": " --set logzio-k8s-telemetry.secrets.TracesToken='<>' \\" }, - { - "template": " --set logzio-k8s-telemetry.secrets.LogzioRegion='<>' \\" - }, { "template": " --set logzio-k8s-telemetry.spm.enabled=true \\", "targetElement": "capabilities[?(@ == 'SPM')]", diff --git a/datasources/windows/kubernetes/aks/kubernetes/telemetry/metrics/functions.ps1 b/datasources/windows/kubernetes/aks/kubernetes/telemetry/metrics/functions.ps1 index eeb2d4ff0..44a2fe6f3 100755 --- a/datasources/windows/kubernetes/aks/kubernetes/telemetry/metrics/functions.ps1 +++ b/datasources/windows/kubernetes/aks/kubernetes/telemetry/metrics/functions.ps1 @@ -416,6 +416,11 @@ function Build-LogzioRegionHelmSet { $local:ExitCode = 3 $local:FuncName = $MyInvocation.MyCommand.Name + + # Check if LogzioRegion already exists in HelmSets + if ($script:LogHelmSets -match "logzio-k8s-telemetry\.secrets\.LogzioRegion=[^ ]+") { + return + } $local:Message = 'Building Logz.io region Helm set ...' Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepMetrics $script:LogScriptMetrics $FuncName $script:AgentId $script:Platform $script:Subtype $script:CurrentDataSource diff --git a/datasources/windows/kubernetes/aks/kubernetes/telemetry/traces/functions.ps1 b/datasources/windows/kubernetes/aks/kubernetes/telemetry/traces/functions.ps1 index a8fdeb64b..bb1e5b9d5 100755 --- a/datasources/windows/kubernetes/aks/kubernetes/telemetry/traces/functions.ps1 +++ b/datasources/windows/kubernetes/aks/kubernetes/telemetry/traces/functions.ps1 @@ -108,6 +108,11 @@ function Build-LogzioRegionHelmSet { $local:ExitCode = 3 $local:FuncName = $MyInvocation.MyCommand.Name + # Check if LogzioRegion already exists in HelmSets + if ($script:LogHelmSets -match "logzio-k8s-telemetry\.secrets\.LogzioRegion=[^ ]+") { + return + } + $local:Message = 'Building Logz.io region Helm set ...' Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepTraces $script:LogScriptTraces $FuncName $script:AgentId $script:Platform $script:Subtype $script:CurrentDataSource Write-Log $script:LogLevelDebug $Message @@ -230,4 +235,4 @@ function Build-LogzioSpmTokenHelmSet { Write-TaskPostRun "`$script:LogHelmSets += '$HelmSet'" Write-TaskPostRun "`$script:HelmSets += '$HelmSet'" -} +} \ No newline at end of file diff --git a/datasources/windows/kubernetes/digitalocean/kubernetes/telemetry/metrics/functions.ps1 b/datasources/windows/kubernetes/digitalocean/kubernetes/telemetry/metrics/functions.ps1 index a9cc2eb76..d26465932 100755 --- a/datasources/windows/kubernetes/digitalocean/kubernetes/telemetry/metrics/functions.ps1 +++ b/datasources/windows/kubernetes/digitalocean/kubernetes/telemetry/metrics/functions.ps1 @@ -352,7 +352,6 @@ function Build-EnableObjectLogsHelmSet { Write-TaskPostRun "`$script:LogHelmSets += '$HelmSet'" Write-TaskPostRun "`$script:HelmSets += '$HelmSet'" } - # Builds Logz.io region Helm set # Input: # FuncArgs - Hashtable {ListenerUrl = $script:ListenerUrl} @@ -365,6 +364,11 @@ function Build-LogzioRegionHelmSet { $local:ExitCode = 3 $local:FuncName = $MyInvocation.MyCommand.Name + + # Check if LogzioRegion already exists in HelmSets + if ($script:LogHelmSets -match "logzio-k8s-telemetry\.secrets\.LogzioRegion=[^ ]+") { + return + } $local:Message = 'Building Logz.io region Helm set ...' Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepMetrics $script:LogScriptMetrics $FuncName $script:AgentId $script:Platform $script:Subtype $script:CurrentDataSource diff --git a/datasources/windows/kubernetes/digitalocean/kubernetes/telemetry/traces/functions.ps1 b/datasources/windows/kubernetes/digitalocean/kubernetes/telemetry/traces/functions.ps1 index a8fdeb64b..983148495 100755 --- a/datasources/windows/kubernetes/digitalocean/kubernetes/telemetry/traces/functions.ps1 +++ b/datasources/windows/kubernetes/digitalocean/kubernetes/telemetry/traces/functions.ps1 @@ -107,6 +107,11 @@ function Build-LogzioRegionHelmSet { $local:ExitCode = 3 $local:FuncName = $MyInvocation.MyCommand.Name + + # Check if LogzioRegion already exists in HelmSets + if ($script:LogHelmSets -match "logzio-k8s-telemetry\.secrets\.LogzioRegion=[^ ]+") { + return + } $local:Message = 'Building Logz.io region Helm set ...' Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepTraces $script:LogScriptTraces $FuncName $script:AgentId $script:Platform $script:Subtype $script:CurrentDataSource @@ -230,4 +235,4 @@ function Build-LogzioSpmTokenHelmSet { Write-TaskPostRun "`$script:LogHelmSets += '$HelmSet'" Write-TaskPostRun "`$script:HelmSets += '$HelmSet'" -} +} \ No newline at end of file diff --git a/datasources/windows/kubernetes/eks/kubernetes/telemetry/metrics/functions.ps1 b/datasources/windows/kubernetes/eks/kubernetes/telemetry/metrics/functions.ps1 index e5a4d2325..c6a0d99b5 100755 --- a/datasources/windows/kubernetes/eks/kubernetes/telemetry/metrics/functions.ps1 +++ b/datasources/windows/kubernetes/eks/kubernetes/telemetry/metrics/functions.ps1 @@ -388,6 +388,11 @@ function Build-LogzioRegionHelmSet { $local:ExitCode = 3 $local:FuncName = $MyInvocation.MyCommand.Name + + # Check if LogzioRegion already exists in HelmSets + if ($script:LogHelmSets -match "logzio-k8s-telemetry\.secrets\.LogzioRegion=[^ ]+") { + return + } $local:Message = 'Building Logz.io region Helm set ...' Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepMetrics $script:LogScriptMetrics $FuncName $script:AgentId $script:Platform $script:Subtype $script:CurrentDataSource diff --git a/datasources/windows/kubernetes/eks/kubernetes/telemetry/traces/functions.ps1 b/datasources/windows/kubernetes/eks/kubernetes/telemetry/traces/functions.ps1 index a8fdeb64b..983148495 100755 --- a/datasources/windows/kubernetes/eks/kubernetes/telemetry/traces/functions.ps1 +++ b/datasources/windows/kubernetes/eks/kubernetes/telemetry/traces/functions.ps1 @@ -107,6 +107,11 @@ function Build-LogzioRegionHelmSet { $local:ExitCode = 3 $local:FuncName = $MyInvocation.MyCommand.Name + + # Check if LogzioRegion already exists in HelmSets + if ($script:LogHelmSets -match "logzio-k8s-telemetry\.secrets\.LogzioRegion=[^ ]+") { + return + } $local:Message = 'Building Logz.io region Helm set ...' Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepTraces $script:LogScriptTraces $FuncName $script:AgentId $script:Platform $script:Subtype $script:CurrentDataSource @@ -230,4 +235,4 @@ function Build-LogzioSpmTokenHelmSet { Write-TaskPostRun "`$script:LogHelmSets += '$HelmSet'" Write-TaskPostRun "`$script:HelmSets += '$HelmSet'" -} +} \ No newline at end of file diff --git a/datasources/windows/kubernetes/gke/kubernetes/telemetry/metrics/functions.ps1 b/datasources/windows/kubernetes/gke/kubernetes/telemetry/metrics/functions.ps1 index 6f00a2ab8..d26465932 100755 --- a/datasources/windows/kubernetes/gke/kubernetes/telemetry/metrics/functions.ps1 +++ b/datasources/windows/kubernetes/gke/kubernetes/telemetry/metrics/functions.ps1 @@ -364,6 +364,11 @@ function Build-LogzioRegionHelmSet { $local:ExitCode = 3 $local:FuncName = $MyInvocation.MyCommand.Name + + # Check if LogzioRegion already exists in HelmSets + if ($script:LogHelmSets -match "logzio-k8s-telemetry\.secrets\.LogzioRegion=[^ ]+") { + return + } $local:Message = 'Building Logz.io region Helm set ...' Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepMetrics $script:LogScriptMetrics $FuncName $script:AgentId $script:Platform $script:Subtype $script:CurrentDataSource diff --git a/datasources/windows/kubernetes/gke/kubernetes/telemetry/traces/functions.ps1 b/datasources/windows/kubernetes/gke/kubernetes/telemetry/traces/functions.ps1 index a8fdeb64b..983148495 100755 --- a/datasources/windows/kubernetes/gke/kubernetes/telemetry/traces/functions.ps1 +++ b/datasources/windows/kubernetes/gke/kubernetes/telemetry/traces/functions.ps1 @@ -107,6 +107,11 @@ function Build-LogzioRegionHelmSet { $local:ExitCode = 3 $local:FuncName = $MyInvocation.MyCommand.Name + + # Check if LogzioRegion already exists in HelmSets + if ($script:LogHelmSets -match "logzio-k8s-telemetry\.secrets\.LogzioRegion=[^ ]+") { + return + } $local:Message = 'Building Logz.io region Helm set ...' Send-LogToLogzio $script:LogLevelDebug $Message $script:LogStepTraces $script:LogScriptTraces $FuncName $script:AgentId $script:Platform $script:Subtype $script:CurrentDataSource @@ -230,4 +235,4 @@ function Build-LogzioSpmTokenHelmSet { Write-TaskPostRun "`$script:LogHelmSets += '$HelmSet'" Write-TaskPostRun "`$script:HelmSets += '$HelmSet'" -} +} \ No newline at end of file diff --git a/resources-linux/k8s/datasource_logs_utils.bash b/resources-linux/k8s/datasource_logs_utils.bash index b8213367c..52d855de7 100755 --- a/resources-linux/k8s/datasource_logs_utils.bash +++ b/resources-linux/k8s/datasource_logs_utils.bash @@ -84,7 +84,7 @@ function build_logzio_logs_region_helm_set { send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_TRACES" "$LOG_SCRIPT_TRACES" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE" write_log "$LOG_LEVEL_DEBUG" "$message" - local helm_set=" --set logzio-logs-collector.secrets.LogzioRegion=$region" + local helm_set=" --set logzio-logs-collector.secrets.logzioRegion=$region" message="Logz.io region Helm set is '$helm_set'" send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_TRACES" "$LOG_SCRIPT_TRACES" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE" @@ -322,4 +322,4 @@ function build_deploy_events_environment_id_helm_set { write_task_post_run "LOG_HELM_SETS+='$helm_set'" write_task_post_run "HELM_SETS+='$helm_set'" -} +} \ No newline at end of file diff --git a/resources-linux/k8s/datasource_metrics_utils.bash b/resources-linux/k8s/datasource_metrics_utils.bash index 9b3b5184b..9c9bde288 100755 --- a/resources-linux/k8s/datasource_metrics_utils.bash +++ b/resources-linux/k8s/datasource_metrics_utils.bash @@ -199,6 +199,11 @@ function build_enable_object_logs_helm_set { function build_logzio_region_helm_set { local func_name="${FUNCNAME[0]}" + # Check if LogzioRegion already exists in HelmSets + if [[ "$LOG_HELM_SETS" =~ logzio-k8s-telemetry.secrets.LogzioRegion ]]; then + return + fi + local message='Building Logz.io region Helm set ...' send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_METRICS" "$LOG_SCRIPT_METRICS" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE" write_log "$LOG_LEVEL_DEBUG" "$message" @@ -241,4 +246,3 @@ function build_logzio_object_logs_token_helm_set { write_task_post_run "LOG_HELM_SETS+='$helm_set'" write_task_post_run "HELM_SETS+='$helm_set'" } - diff --git a/resources-linux/k8s/datasource_traces_utils.bash b/resources-linux/k8s/datasource_traces_utils.bash index 2547869ba..ea88df64d 100755 --- a/resources-linux/k8s/datasource_traces_utils.bash +++ b/resources-linux/k8s/datasource_traces_utils.bash @@ -58,6 +58,11 @@ function build_logzio_traces_token_helm_set { # HELM_SETS - Contains all the Helm sets function build_logzio_region_helm_set { local func_name="${FUNCNAME[0]}" + + # Check if LogzioRegion already exists in HelmSets + if [[ "$LOG_HELM_SETS" =~ logzio-k8s-telemetry.secrets.LogzioRegion ]]; then + return + fi local message='Building Logz.io region Helm set ...' send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_TRACES" "$LOG_SCRIPT_TRACES" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE" @@ -123,4 +128,4 @@ function build_logzio_spm_token_helm_set { write_task_post_run "LOG_HELM_SETS+='$helm_set'" write_task_post_run "HELM_SETS+='$helm_set'" -} +} \ No newline at end of file diff --git a/resources-mac/k8s/datasource_logs_utils.bash b/resources-mac/k8s/datasource_logs_utils.bash index 8dc6895d4..eeeec97ec 100755 --- a/resources-mac/k8s/datasource_logs_utils.bash +++ b/resources-mac/k8s/datasource_logs_utils.bash @@ -84,7 +84,7 @@ function build_logzio_logs_region_helm_set { send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_TRACES" "$LOG_SCRIPT_TRACES" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE" write_log "$LOG_LEVEL_DEBUG" "$message" - local helm_set=" --set logzio-logs-collector.secrets.LogzioRegion=$region" + local helm_set=" --set logzio-logs-collector.secrets.logzioRegion=$region" message="Logz.io region Helm set is '$helm_set'" send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_TRACES" "$LOG_SCRIPT_TRACES" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE" @@ -322,4 +322,4 @@ function build_deploy_events_environment_id_helm_set { write_task_post_run "LOG_HELM_SETS+='$helm_set'" write_task_post_run "HELM_SETS+='$helm_set'" -} +} \ No newline at end of file diff --git a/resources-mac/k8s/datasource_metrics_utils.bash b/resources-mac/k8s/datasource_metrics_utils.bash index 214bd6114..dae905581 100755 --- a/resources-mac/k8s/datasource_metrics_utils.bash +++ b/resources-mac/k8s/datasource_metrics_utils.bash @@ -198,6 +198,11 @@ function build_enable_object_logs_helm_set { # HELM_SETS - Contains all the Helm sets function build_logzio_region_helm_set { local func_name="${FUNCNAME[0]}" + + # Check if LogzioRegion already exists in HelmSets + if [[ "$LOG_HELM_SETS" =~ logzio-k8s-telemetry.secrets.LogzioRegion ]]; then + return + fi local message='Building Logz.io region Helm set ...' send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_METRICS" "$LOG_SCRIPT_METRICS" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE" @@ -240,4 +245,4 @@ function build_logzio_object_logs_token_helm_set { write_task_post_run "LOG_HELM_SETS+='$helm_set'" write_task_post_run "HELM_SETS+='$helm_set'" -} +} \ No newline at end of file diff --git a/resources-mac/k8s/datasource_traces_utils.bash b/resources-mac/k8s/datasource_traces_utils.bash index adead58f6..af97d856b 100755 --- a/resources-mac/k8s/datasource_traces_utils.bash +++ b/resources-mac/k8s/datasource_traces_utils.bash @@ -59,6 +59,11 @@ function build_logzio_traces_token_helm_set { function build_logzio_region_helm_set { local func_name="${FUNCNAME[0]}" + # Check if LogzioRegion already exists in HelmSets + if [[ "$LOG_HELM_SETS" =~ logzio-k8s-telemetry.secrets.LogzioRegion ]]; then + return + fi + local message='Building Logz.io region Helm set ...' send_log_to_logzio "$LOG_LEVEL_DEBUG" "$message" "$LOG_STEP_TRACES" "$LOG_SCRIPT_TRACES" "$func_name" "$AGENT_ID" "$PLATFORM" "$SUB_TYPE" "$CURRENT_DATA_SOURCE" write_log "$LOG_LEVEL_DEBUG" "$message" @@ -123,4 +128,4 @@ function build_logzio_spm_token_helm_set { write_task_post_run "LOG_HELM_SETS+='$helm_set'" write_task_post_run "HELM_SETS+='$helm_set'" -} +} \ No newline at end of file