Skip to content

Commit

Permalink
v0.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
smithclay committed Feb 28, 2024
1 parent d7acf52 commit e3b9628
Show file tree
Hide file tree
Showing 67 changed files with 4,113 additions and 697 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @lightstep/sn-collector-approvers
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---
<!-- Thank you for contributing. We're providing support via GitHub on a best effort basis. Please also open a case at https://support.servicenow.com if you are a ServiceNow customer. -->

**Describe the bug**
A clear and concise description of what the bug is.

**Steps to reproduce**
If possible, provide a recipe for reproducing the error.

**What did you expect to see?**
A clear and concise description of what you expected to see.

**What did you see instead?**
A clear and concise description of what you saw instead.

**Environment**
Describe any aspect of your environment relevant to the problem,
for example operating system or Kubernetes cluster version.
If this is related to a deployment of the collector please
provide your Collector config file.

**Additional context**
Add any other context about the problem here.
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: Feature request
about: Suggest an idea for the ServiceNow Collector
title: ''
labels: ''
assignees: ''

---
<!-- Thank you for contributing. We're providing support via GitHub on a best effort basis. Please also open a case at https://support.servicenow.com if you are a ServiceNow customer. -->

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'd like to send data in a different format [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->

**Link to tracking Issue:** <Issue number if applicable>

**Testing:** <Describe what testing was performed and which tests were added.>

**Documentation:** <Describe the documentation added.>


<!-- DO NOT DELETE -->
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
63 changes: 63 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Build is responsible for testing builds on all supported platforms.
# It is broken up into three separate jobs with targeted builds so that each OS will
# build in parallel and speed up overall CI time.
name: Build
on:
pull_request:
paths:
- collector/**
jobs:
build_linux:
runs-on: ubuntu-20.04
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21.5'
check-latest: true
- name: Install builder
working-directory: ./collector
run: |
go install go.opentelemetry.io/collector/cmd/[email protected]
- name: Build
working-directory: ./collector
run: make build-linux
- name: Validate
working-directory: ./collector
run: make validate-linux
# build_darwin:
# runs-on: macos-14
# steps:
# - name: Checkout Sources
# uses: actions/checkout@v4
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: '~1.21.5'
# check-latest: true
# - name: Install builder
# working-directory: ./collector
# run: |
# go install go.opentelemetry.io/collector/cmd/[email protected]
# - name: Build
# working-directory: ./collector
# run: make build-darwin
# build_windows:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout Sources
# uses: actions/checkout@v4
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: '~1.21.5'
# check-latest: true
# - name: Install builder
# working-directory: ./collector
# run: |
# go install go.opentelemetry.io/collector/cmd/[email protected]
# - name: Build
# working-directory: ./collector
# run: make build-windows
14 changes: 14 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Check Pull Request
on:
pull_request:

jobs:
yamllint:
runs-on: ubuntu-latest
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
35 changes: 35 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test Install

on:
release:
types: [published]

jobs:
# Untar and validate collector and config from *.tar.gz
install_gzip:
runs-on: ubuntu-20.04
steps:
- name: Untar latest release
uses: robinraju/[email protected]
with:
latest: true
extract: true
fileName: otelcol-servicenow_*_linux_amd64.tar.gz
- name: Validate otelcol-servicenow
run: ./otelcol-servicenow validate --config config/otelcol-linux-hostmetrics.yaml

# Install and validate collector and config from *.deb
install_deb:
runs-on: ubuntu-20.04
steps:
- name: Download latest *.deb release
uses: robinraju/[email protected]
with:
latest: true
extract: false
fileName: sn-collector_*_linux_amd64.deb
- run: ls -la
- name: Install otelcol-servicenow
run: sudo dpkg -i sn-collector_*_linux_amd64.deb
- name: Validate otelcol-servicenow
run: sudo /opt/sn-collector/otelcol-servicenow validate --config /opt/sn-collector/config.yaml
97 changes: 97 additions & 0 deletions .github/workflows/release-msi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Based on https://github.com/Bedrock-OSS/regolith/blob/b340a6f4bd208b265c3a0f6bbb59206ab8486545/.github/workflows/release.yml
# https://dev.to/abdfnx/how-to-create-a-msi-file-for-go-program-je

name: Release Windows MSI

on:
push:
tags: ["v*"]

jobs:
release-msi:
permissions:
id-token: write
packages: write
contents: write

runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21.5'
check-latest: true

- name: Install Tools
working-directory: collector
run: make install-tools

- name: Build collector
working-directory: collector
run: make build-windows

- run: mv .\otelcol-servicenow\otelcol-servicenow .\otelcol-servicenow.exe
working-directory: collector

- name: Validate collector release
working-directory: collector
run: .\otelcol-servicenow.exe validate --config config\otelcol-windows-hostmetrics.yaml

- run: ls -la
shell: bash

- name: Cache Wix Toolset
id: cache-wix
uses: actions/cache@v3
with:
path: C:/wix-311
key: wix

- name: Set up Wix Toolset
if: steps.cache-wix.outputs.cache-hit != 'true'
run: |
mkdir -p C:/wix
curl -o "C:/wix/wix311-binaries.zip" -OL https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip
unzip C:/wix/wix311-binaries.zip -d "C:/wix"
echo "C:\wix" >> $GITHUB_PATH
go install github.com/stirante/go-msi@latest
ls -la
mkdir collector/windows/go-msi-tmp
cp collector/config/otelcol-windows-hostmetrics.yaml collector/windows/config.yaml
cp collector/otelcol-servicenow.exe collector/windows/otelcol-servicenow.exe
cp LICENSE collector/windows/LICENSE.txt
shell: bash

- name: Build MSI
if: startsWith(github.ref, 'refs/tags/')
run: |
ls -la
cd collector/windows
ls -la
go-msi make --msi sn-collector.msi --version ${{ github.ref_name }} --src templates --out .\go-msi-tmp
shell: bash

- name: Diagnostics
run: |
pwd
ls -la
shell: bash

- name: Upload MSI Artifact
uses: actions/upload-artifact@v4
with:
name: sn-collector.msi
path: collector/windows/sn-collector.msi
# Short lived because this is meant as an action for developers
retention-days: 1

- name: Add MSI to Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
collector/windows/sn-collector.msi
72 changes: 72 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# based on: https://github.com/open-telemetry/opentelemetry-collector-releases/blob/main/.github/workflows/release.yaml
name: Release

on:
push:
tags: ["v*"]

jobs:
release:
permissions:
id-token: write
packages: write
contents: write

runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: docker/setup-qemu-action@v3
with:
platforms: arm64,linux/arm/v7

- uses: docker/setup-buildx-action@v3

- uses: actions/setup-go@v5
with:
go-version: '~1.21.5'
check-latest: true

- name: Install tools
working-directory: collector
run: make install-tools

- name: Generate distribution sources
working-directory: collector
run: builder --config otelcol-builder.yaml --skip-compilation

- name: Login to GitHub Package Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: anchore/sbom-action/[email protected]

- name: Install Cosign
uses: sigstore/[email protected]
with:
cosign-release: 'v2.2.3'

- name: Build cosign key file
run: 'echo "$COSIGN_PRIVATE_KEY" >> cosign.key'
shell: bash
env:
COSIGN_PRIVATE_KEY: ${{secrets.ORG_COSIGN_PRIVATE_KEY}}

- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --timeout 2h
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COSIGN_PWD: ${{ secrets.ORG_COSIGN_PWD }}
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tests
on:
pull_request:
paths:
- collector/**

jobs:
unit-tests:
strategy:
fail-fast: false
matrix:
#os: [ubuntu-20.04, macos-14, windows-2022-8-cores]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.20"
check-latest: true
- name: Run tests
working-directory: ./collector
run: |
make test
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
.DS_Store
collector/otelcol-servicenow/
collector/otelcol-servicenow/
dist/
cosign.*
gpg.*
*.msi
*.exe
.vscode
Loading

0 comments on commit e3b9628

Please sign in to comment.