Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
2 changes: 1 addition & 1 deletion actions/instrument/job/inject_and_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fi
bash -e -o pipefail ../shared/install.sh perl curl wget jq sed unzip parallel 'node;nodejs' npm 'gcc;build-essential' lsof
if ! type otelcol-contrib; then
if ! [ -r /var/cache/apt/archives/otelcol-contrib.deb ]; then
GITHUB_REPOSITORY=open-telemetry/opentelemetry-collector-releases gh_curl /releases/tags/v"$(cat Dockerfile | grep '^FROM ' | cut -d ' ' -f 2- | cut -d : -f 2)" | jq '.assets[] | select(.name | endswith(".deb")) | [ .name, .url ] | @tsv' -r | grep contrib | grep linux | grep "$(arch | sed 's/x86_64/amd64/g')" | head -n 1 | cut -d $'\t' -f 2 \
GITHUB_REPOSITORY=open-telemetry/opentelemetry-collector-releases gh_release v"$(cat Dockerfile | grep '^FROM ' | cut -d ' ' -f 2- | cut -d : -f 2)" | jq '.assets[] | select(.name | endswith(".deb")) | [ .name, .url ] | @tsv' -r | grep contrib | grep linux | grep "$(arch | sed 's/x86_64/amd64/g')" | head -n 1 | cut -d $'\t' -f 2 \
| xargs -I '{}' wget -q --header "Authorization: Bearer $INPUT_GITHUB_TOKEN" --header "Accept: application/octet-stream" '{}' -O - | sudo tee /var/cache/apt/archives/otelcol-contrib.deb > /dev/null
Comment thread
plengauer marked this conversation as resolved.
fi
if [ "${FAST_DEB_INSTALL:-FALSE}" = TRUE ]; then # lets assume no install scripts or dependencies or triggers
Expand Down
13 changes: 12 additions & 1 deletion actions/instrument/shared/github.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,21 @@ gh_rate_limit() {
export -f gh_rate_limit

gh_releases() {
GITHUB_REPOSITORY="$GITHUB_ACTION_REPOSITORY" gh_curl_paginated /releases'?per_page=100'
gh_curl_paginated /releases'?per_page=100'
Comment thread
plengauer marked this conversation as resolved.
}
export -f gh_releases

gh_release() {
local tag="$1"
if [ "$tag" = main ]; then
local path=latest
else
local path=tag/"$tag"
fi
Comment thread
plengauer marked this conversation as resolved.
gh_curl /releases/"$path"
}
export -f gh_release

gh_workflow_runs() {
gh_curl_paginated /actions/runs'?per_page=100'
}
Expand Down
7 changes: 2 additions & 5 deletions actions/instrument/shared/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ if ! type otel.sh 2> /dev/null; then
sudo -E -H eatmydata apt-get install -y "$GITHUB_WORKSPACE"/package.deb
else
debian_file=/var/cache/apt/archives/opentelemetry-shell_"$(cat ../../../VERSION)"_all.deb
gh_releases | if [ "$action_tag_name" = main ]; then
jq '.[0]'
else
jq '.[] | select(.tag_name=="v'"$(cat ../../../VERSION)"'")'
fi | jq '.assets[] | select(.name | endswith(".deb")) | .url' -r | xargs -0 -I '{}' wget --header "Authorization: Bearer $INPUT_GITHUB_TOKEN" --header 'Accept: application/octet-stream' -O - '{}' | sudo tee "$debian_file" > /dev/null
[ "$action_tag_name" = main ] || action_tag_name=v"$(cat ../../../VERSION)"
GITHUB_REPOSITORY="$GITHUB_ACTION_REPOSITORY" gh_release "$action_tag_name" | jq '.assets[] | select(.name | endswith(".deb")) | .url' -r | xargs -0 -I '{}' wget --header "Authorization: Bearer $INPUT_GITHUB_TOKEN" --header 'Accept: application/octet-stream' -O - '{}' | sudo tee "$debian_file" > /dev/null
Comment thread
plengauer marked this conversation as resolved.
sudo -E -H eatmydata apt-get -o Binary::apt::APT::Keep-Downloaded-Packages=true install -y "$debian_file"
fi || (
echo ::warning::'Cannot find release for specified tag, falling back to latest. This may be due to tags that haven'\''t finished building yet (like in a fresh fork), in which case this will resolve automatically.' >&2
Expand Down
Loading