Skip to content

Commit

Permalink
Release v0.0.10 (#6)
Browse files Browse the repository at this point in the history
* update macOS automated installer

* update docs

* update msi release to include version number

* remove sboms and apk packages

* add unix autoinstaller script

* add postrelease install check

* allow token to be set during autoinstall

* skip CI build + test on documentation updates

* add markdown link check

* fix broken link
  • Loading branch information
smithclay authored Feb 28, 2024
1 parent e3b9628 commit 99735f2
Show file tree
Hide file tree
Showing 18 changed files with 833 additions and 107 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ name: Build
on:
pull_request:
paths:
- collector/**
- '!docs/**'
- '!readme.md'

jobs:
build_linux:
runs-on: ubuntu-20.04
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ on:

jobs:
yamllint:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: yaml-lint
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: collector/config/*.yaml collector/config-k8s/*.yaml
config_file: .yamllint.yml
markdown-link-check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
folder-path: 'docs/'
max-depth: 2
35 changes: 0 additions & 35 deletions .github/workflows/install.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/release-msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
ls -la
cd collector/windows
ls -la
go-msi make --msi sn-collector.msi --version ${{ github.ref_name }} --src templates --out .\go-msi-tmp
go-msi make --msi sn-collector_${{ github.ref_name }}.msi --version ${{ github.ref_name }} --src templates --out .\go-msi-tmp
shell: bash

- name: Diagnostics
Expand All @@ -84,8 +84,8 @@ jobs:
- name: Upload MSI Artifact
uses: actions/upload-artifact@v4
with:
name: sn-collector.msi
path: collector/windows/sn-collector.msi
name: sn-collector_${{ github.ref_name }}.msi
path: collector/windows/sn-collector_${{ github.ref_name }}.msi
# Short lived because this is meant as an action for developers
retention-days: 1

Expand All @@ -94,4 +94,4 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
collector/windows/sn-collector.msi
collector/windows/sn-collector_${{ github.ref_name }}.msi
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,17 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_PWD: ${{ secrets.ORG_COSIGN_PWD }}

postrelease:
runs-on: ubuntu-20.04
needs: release
steps:
- name: Untar latest prerelease
uses: robinraju/[email protected]
with:
latest: true
extract: true
preRelease: true
fileName: otelcol-servicenow_*_linux_amd64.tar.gz
- name: Validate otelcol-servicenow
run: ./otelcol-servicenow validate --config config/otelcol-linux-hostmetrics.yaml
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Tests
on:
pull_request:
paths:
- collector/**
- '!docs/**'
- '!readme.md'

jobs:
unit-tests:
Expand Down
8 changes: 4 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ nfpms:
maintainer: ServiceNow Engineering <[email protected]>
description: SerivceNow distribution of the OpenTelemetry Collector.
formats:
- apk
- deb
- rpm
bindir: /opt/sn-collector
Expand Down Expand Up @@ -138,9 +137,9 @@ signs:
artifacts: all

# https://goreleaser.com/customization/sbom/
sboms:
- artifacts: archive
cmd: syft
# sboms:
# - artifacts: archive
# cmd: syft

checksum:
name_template: 'checksums.txt'
Expand All @@ -149,4 +148,5 @@ release:
draft: false
prerelease: "true"
extra_files:
- glob: "./collector/scripts/install/install-unix.sh"
- glob: "./collector/scripts/install/install-macos.sh"
4 changes: 2 additions & 2 deletions collector/config/otelcol-linux-hostmetrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ exporters:
otlp/lightstep:
endpoint: ingest.lightstep.com:443
headers:
"lightstep-access-token": "${LS_TOKEN}"
"lightstep-access-token": "YOUR_TOKEN"
sending_queue:
enabled: true
num_consumers: 4
Expand Down Expand Up @@ -78,4 +78,4 @@ service:
metrics/host:
receivers: [hostmetrics]
processors: [batch, resourcedetection]
exporters: [debug]
exporters: [debug, otlp/lightstep]
6 changes: 3 additions & 3 deletions collector/config/otelcol-macos-hostmetrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exporters:
otlp/lightstep:
endpoint: ingest.lightstep.com:443
headers:
"lightstep-access-token": "${LS_TOKEN}"
"lightstep-access-token": "YOUR_TOKEN"
sending_queue:
enabled: true
num_consumers: 4
Expand Down Expand Up @@ -74,8 +74,8 @@ service:
metrics/collector:
receivers: [prometheus/self]
processors: [batch, resourcedetection]
exporters: [debug]
exporters: [debug, otlp/lightstep]
metrics/host:
receivers: [hostmetrics]
processors: [batch, resourcedetection]
exporters: [debug]
exporters: [debug, otlp/lightstep]
2 changes: 1 addition & 1 deletion collector/otelcol-builder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dist:
description: ServiceNow-flavored OpenTelemetry Collector distro
output_path: ./otelcol-servicenow
otelcol_version: 0.95.0
version: 0.0.9
version: 0.0.10

exporters:
- gomod:
Expand Down
51 changes: 16 additions & 35 deletions collector/scripts/install/install-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ DOWNLOAD_BASE="https://github.com/lightstep/sn-collector/releases/download"
PREREQS="printf sed uname tr find grep"
TMP_DIR="${TMPDIR:-"/tmp/"}sn-collector" # Allow this to be overriden by cannonical TMPDIR env var
INSTALL_DIR="/opt/sn-collector"
MANAGEMENT_YML_PATH="$INSTALL_DIR/manager.yaml"
SCRIPT_NAME="$0"
INDENT_WIDTH=' '
indent=""
Expand Down Expand Up @@ -153,17 +152,11 @@ Usage:
Example: '-b http://my.domain.org/servicenow-collector/binaries' will be used as the base of the download URL.
$(fg_yellow '-e, --endpoint')
Defines the endpoint of an OpAMP compatible management server for this agent install.
This parameter may also be provided through the ENDPOINT environment variable.
Specifying this will install the agent in a managed mode, as opposed to the
normal headless mode.
Defines the Cloud Observability ingest endpoint for telemetry
$(fg_yellow '-i, --ingest-token')
Defines the secret key to be used when communicating with an OpAMP compatible server.
This parameter may also be provided through the SECRET_KEY environment variable.
The '--endpoint' flag must be specified if this flag is specified.
Defines the token to be used when communicating with Cloud Observability
EOF
)
info "$USAGE"
Expand Down Expand Up @@ -348,7 +341,7 @@ set_download_urls()
base_url=$DOWNLOAD_BASE
fi

collector_download_url="$base_url/v$version/otelcol-servicenow_v${version}_darwin_${os_arch}.tar.gz"
collector_download_url="$base_url/v$version/otelcol-servicenow_${version}_darwin_${os_arch}.tar.gz"
else
collector_download_url="$url"
fi
Expand All @@ -370,20 +363,22 @@ set_ingest_token()
fi

INGEST_TOKEN="$ingest_token"

if [ -n "$INGEST_TOKEN" ] && [ -z "$INGEST_ENDPOINT" ]; then
error_exit "$LINENO" "An endpoint must be specified when providing an ingest token"
fi
}

# latest_version gets the tag of the latest release, without the v prefix.
latest_version()
{
curl -sSL -H"Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/lightstep/sn-collector/releases/latest | \
curl -sSL -H"Accept: application/vnd.github.v3+json" "https://api.github.com/repos/lightstep/sn-collector/releases/latest" | \
grep "\"tag_name\"" | \
sed -E 's/ *"tag_name": "v([0-9]+\.[0-9]+\.[0-9+])",/\1/'
}

# set the access token, if one was specified
set_access_token()
{
sed -i "s/YOUR_TOKEN/$INGEST_TOKEN/g" /opt/sn-collector/config.yaml
}

# This will install the package by downloading & unpacking the tarball into the install directory
install_package()
{
Expand Down Expand Up @@ -441,11 +436,6 @@ install_package()
succeeded
fi

# TODO: If an endpoint was specified, we need to update the config
#if [ -n "$OPAMP_ENDPOINT" ]; then
# create_manager_yml "$MANAGEMENT_YML_PATH"
#fi

if [ -f "/Library/LaunchDaemons/$SERVICE_NAME.plist" ]; then
# Existing service file, we should stop & unload first.
info "Uninstalling existing service file..."
Expand All @@ -459,6 +449,11 @@ install_package()
launchctl load -w "/Library/LaunchDaemons/$SERVICE_NAME.plist" > /dev/null 2>&1 || error_exit "$LINENO" "Failed to load service file /Library/LaunchDaemons/$SERVICE_NAME.plist"
succeeded

if [ -n "$INGEST_TOKEN" ]; then
info "Setting access token..."
set_access_token
fi

info "Starting service..."
launchctl start "$SERVICE_NAME" || error_exit "$LINENO" "Failed to start service file $SERVICE_NAME"
succeeded
Expand All @@ -471,20 +466,6 @@ install_package()
decrease_indent
}

# create_manager_yml creates the manager.yml at the specified path, containing opamp information.
create_manager_yml()
{
manager_yml_path="$1"
if [ ! -f "$manager_yml_path" ]; then
info "Creating manager yaml..."
command printf 'endpoint: "%s"\n' "$OPAMP_ENDPOINT" > "$manager_yml_path"
[ -n "$OPAMP_LABELS" ] && command printf 'labels: "%s"\n' "$OPAMP_LABELS" >> "$manager_yml_path"
[ -n "$OPAMP_SECRET_KEY" ] && command printf 'secret_key: "%s"\n' "$OPAMP_SECRET_KEY" >> "$manager_yml_path"
succeeded
fi
}


# This will display the results of an installation
display_results()
{
Expand Down
Loading

0 comments on commit 99735f2

Please sign in to comment.