Skip to content

Instantly share code, notes, and snippets.

@hkboujrida
Last active December 22, 2023 10:49
Show Gist options
  • Save hkboujrida/0ffbdc703b84d79aa618c0cec51775a7 to your computer and use it in GitHub Desktop.
Save hkboujrida/0ffbdc703b84d79aa618c0cec51775a7 to your computer and use it in GitHub Desktop.
pipelines
trigger:
- main
parameters:
- name: chartName
displayName: 'Select Helm Chart'
type: string
default: 'chart1'
values:
- chart1
- chart2
# Add more chart names as needed
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
sudo snap install helm --classic
sudo snap install yq
chart_url=$(yq e ".charts[] | select(.name == \"${{ parameters.chartName }}\") | .url" charts_list.yml)
chart_version=$(yq e ".charts[] | select(.name == \"${{ parameters.chartName }}\") | .version" charts_list.yml)
helm repo add temp $chart_url --version $chart_version
helm template temp | grep "image:" | awk -F'image: ' '{print $2}' | sed 's/"//g' | sort | uniq > images.txt
displayName: 'Extract Image References from Selected Helm Chart'
steps:
- script: |
sudo snap install yq
chart_url=$(yq e ".charts[] | select(.name == \"${{ parameters.chartName }}\") | .url" charts_list.yml)
chart_version=$(yq e ".charts[] | select(.name == \"${{ parameters.chartName }}\") | .version" charts_list.yml)
echo "##vso[task.setvariable variable=chartUrl]$chart_url"
echo "##vso[task.setvariable variable=chartVersion]$chart_version"
displayName: 'Extract Chart URL and Version'
- script: |
sudo snap install helm --classic
helm repo add temp $(chartUrl) --version $(chartVersion)
helm template temp | grep "image:" | awk -F'image: ' '{print $2}' | sed 's/"//g' | sort | uniq > images.txt
displayName: 'Extract Image References from Helm Chart'
charts:
- name: chart1
url: https://example.com/chart1.tgz
version: 1.0.0
- name: chart2
url: https://example.com/chart2.tgz
version: 2.3.4
# Add more charts as needed
#!/bin/bash
# URL to check
URL="http://example.com"
# Output file
LOG_FILE="response_log.txt"
# Function to perform the check
check_url() {
response=$(curl -o /dev/null -s -w "%{http_code}" $URL)
timestamp=$(date "+%Y-%m-%d %H:%M:%S")
log_entry="$timestamp: Response from $URL - Status Code: $response"
echo $log_entry
echo $log_entry >> $LOG_FILE
}
# Loop to continuously check the URL every 3 seconds
while true; do
check_url
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment