Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate LogzioRegion Helm set & fix release workflow permissions #184

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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\}')
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions config-templates/helm.json
Original file line number Diff line number Diff line change
Expand Up @@ -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='<<LOGZIO_ACCOUNT_REGION_CODE>>' \\"
}
]
},
{
"template": " --set logzio-k8s-telemetry.metrics.enabled=true \\",
"targetElement": "datasources[?(@.name=='Kubernetes')].telemetries[?(@.type=='METRICS')]",
Expand Down Expand Up @@ -85,9 +91,6 @@
"template": " --set logzio-k8s-telemetry.secrets.k8sObjectsLogsToken='<<LOGZIO_LOGS_SHIPPING_TOKEN>>' \\",
"targetElement":
"datasources[?(@.name=='Kubernetes')].telemetries[?(@.type=='METRICS')].params[?(@.name=='isObjectLogs')].value"
},
{
"template": " --set logzio-k8s-telemetry.secrets.LogzioRegion='<<LOGZIO_ACCOUNT_REGION_CODE>>' \\"
}
]
},
Expand All @@ -98,9 +101,6 @@
{
"template": " --set logzio-k8s-telemetry.secrets.TracesToken='<<LOGZIO_TRACING_SHIPPING_TOKEN>>' \\"
},
{
"template": " --set logzio-k8s-telemetry.secrets.LogzioRegion='<<LOGZIO_ACCOUNT_REGION_CODE>>' \\"
},
{
"template": " --set logzio-k8s-telemetry.spm.enabled=true \\",
"targetElement": "capabilities[?(@ == 'SPM')]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -230,4 +235,4 @@ function Build-LogzioSpmTokenHelmSet {

Write-TaskPostRun "`$script:LogHelmSets += '$HelmSet'"
Write-TaskPostRun "`$script:HelmSets += '$HelmSet'"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -230,4 +235,4 @@ function Build-LogzioSpmTokenHelmSet {

Write-TaskPostRun "`$script:LogHelmSets += '$HelmSet'"
Write-TaskPostRun "`$script:HelmSets += '$HelmSet'"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -230,4 +235,4 @@ function Build-LogzioSpmTokenHelmSet {

Write-TaskPostRun "`$script:LogHelmSets += '$HelmSet'"
Write-TaskPostRun "`$script:HelmSets += '$HelmSet'"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -230,4 +235,4 @@ function Build-LogzioSpmTokenHelmSet {

Write-TaskPostRun "`$script:LogHelmSets += '$HelmSet'"
Write-TaskPostRun "`$script:HelmSets += '$HelmSet'"
}
}
4 changes: 2 additions & 2 deletions resources-linux/k8s/datasource_logs_utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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'"
}
}
6 changes: 5 additions & 1 deletion resources-linux/k8s/datasource_metrics_utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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'"
}

7 changes: 6 additions & 1 deletion resources-linux/k8s/datasource_traces_utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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'"
}
}
4 changes: 2 additions & 2 deletions resources-mac/k8s/datasource_logs_utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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'"
}
}
7 changes: 6 additions & 1 deletion resources-mac/k8s/datasource_metrics_utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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'"
}
}
7 changes: 6 additions & 1 deletion resources-mac/k8s/datasource_traces_utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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'"
}
}
Loading