diff --git a/.changelog/1693.changed.txt b/.changelog/1693.changed.txt new file mode 100644 index 0000000000..9ebbb534a1 --- /dev/null +++ b/.changelog/1693.changed.txt @@ -0,0 +1 @@ +chore(ci): remove MSIs from this repo \ No newline at end of file diff --git a/.github/workflows/dev_builds.yml b/.github/workflows/dev_builds.yml index 78a1b71af9..2f8c7cdb78 100644 --- a/.github/workflows/dev_builds.yml +++ b/.github/workflows/dev_builds.yml @@ -451,57 +451,6 @@ jobs: REPO_URL=sumologic/sumologic-otel-collector-dev \ BUILD_TYPE_SUFFIX="-ubi" - package-msi: - name: Package MSI - runs-on: windows-2019 - needs: - - build - strategy: - matrix: - include: - - arch_os: windows_amd64 - platform: x64 - fips: false - - arch_os: windows_amd64 - platform: x64 - fips: true - steps: - - uses: actions/checkout@v4 - - - name: Fetch current branch - run: ./ci/fetch_current_branch.sh - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v2 - - - name: Fetch binary artifact for ${{ matrix.arch_os }} - uses: actions/download-artifact@v4 - with: - name: otelcol-sumo${{ matrix.fips && '-fips' || '' }}-${{ matrix.arch_os }}.exe - path: ./otelcolbuilder/cmd - - - name: Rename fips binary artifact for ${{ matrix.arch_os }} - if: matrix.fips - working-directory: ./otelcolbuilder/cmd - run: mv otelcol-sumo-fips-${{ matrix.arch_os }}.exe otelcol-sumo-${{ matrix.arch_os }}.exe - - - name: Set OVERRIDE_BUILD_NUMBER - run: echo "OVERRIDE_BUILD_VERSION=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV - - - name: Set PRODUCT_VERSION - run: echo "PRODUCT_VERSION=$(./ci/get_version.sh productversion)" >> $GITHUB_ENV - - - name: Build MSI for ${{ matrix.arch_os }} - working-directory: ./packaging/msi/wix - run: msbuild.exe -p:Configuration=Release -p:Platform=${{ matrix.platform }} -p:ProductVersion=$PRODUCT_VERSION -p:FIPSEnabled=${{ matrix.fips }} -Restore - - - name: Store MSI as action artifact for ${{ matrix.arch_os }} - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.arch_os }}${{ matrix.fips && '_fips' || '' }}_msi - path: ./packaging/msi/wix/bin/${{ matrix.platform }}/en-US/*.msi - if-no-files-found: error - install-script: name: Store install script runs-on: ubuntu-latest @@ -530,10 +479,8 @@ jobs: - build - build-otelcol-config - lint - - package-msi - push-docker-manifest uses: ./.github/workflows/workflow-trigger-packaging.yml secrets: inherit with: workflow_id: ${{ github.run_id }} - create_release: false diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 267e24bd4b..54be4830ab 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -175,30 +175,6 @@ jobs: save-cache: true boringcrypto: ${{ matrix.boringcrypto == true }} - test-wixext: - name: Test (SumoLogic.wixext) - runs-on: windows-2019 - steps: - - uses: actions/checkout@v4 - - - name: Fetch current branch - run: ./ci/fetch_current_branch.sh - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v2 - - - name: Restore NuGet packages - working-directory: ./packaging/msi/SumoLogic.wixext/SumoLogicTests - run: nuget.exe restore -PackagesDirectory ../packages - - - name: Build unit tests - working-directory: ./packaging/msi/SumoLogic.wixext/SumoLogicTests - run: msbuild.exe -p:Configuration=Release -p:Platform=AnyCPU -Restore - - - name: Run unit tests - working-directory: ./packaging/msi/SumoLogic.wixext/SumoLogicTests/bin/Release - run: dotnet test -v:n ./SumoLogicTests.dll - lint: name: Lint (golangci-lint) runs-on: ubuntu-20.04 @@ -404,4 +380,4 @@ jobs: - name: Test built image run: make test-built-image - # ToDo: build windows FIPS image + # TODO: build windows FIPS image diff --git a/.github/workflows/release-packaging.yml b/.github/workflows/release-packaging.yml deleted file mode 100644 index 5377726504..0000000000 --- a/.github/workflows/release-packaging.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Trigger packaging for release - -on: - release: - types: [published] - -jobs: - trigger-packaging: - name: Trigger Packaging for release ${{ github.event.release.name }} - uses: ./.github/workflows/workflow-trigger-packaging.yml - secrets: inherit - with: - create_release: true diff --git a/.github/workflows/release_builds.yml b/.github/workflows/releases.yml similarity index 70% rename from .github/workflows/release_builds.yml rename to .github/workflows/releases.yml index 006162b0bd..515a979c58 100644 --- a/.github/workflows/release_builds.yml +++ b/.github/workflows/releases.yml @@ -1,88 +1,85 @@ -name: Releases +name: 'Publish release' + +run-name: > + ${{ format('Publish Release for Workflow: {0}', inputs.workflow_id) }} on: - push: - tags: - - "v[0-9]+.[0-9]+.[0-9]+" - - "v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+" - - "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+" - - "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" - - - "v[0-9]+.[0-9]+.[0-9]+-sumo-[0-9]+" - - "v[0-9]+.[0-9]+.[0-9]+-sumo-[0-9]+-alpha.[0-9]+" - - "v[0-9]+.[0-9]+.[0-9]+-sumo-[0-9]+-beta.[0-9]+" - - "v[0-9]+.[0-9]+.[0-9]+-sumo-[0-9]+-rc.[0-9]+" + workflow_dispatch: + inputs: + workflow_id: + description: | + Workflow Run ID from this repository to fetch artifacts from for this + release. + required: true + type: string defaults: run: shell: bash -env: - GO_VERSION: "1.22.6" - jobs: get-version: name: Get application version for this revision runs-on: ubuntu-latest outputs: + sha: ${{ steps.get-sha.outputs.git-sha }} + otc-version: ${{ steps.get-version.outputs.otc-version }} + sumo-version: ${{ steps.get-version.outputs.sumo-version }} version: ${{ steps.get-version.outputs.version }} steps: - uses: actions/checkout@v4 + + - name: Outuput Workflow ID + run: echo ::notice title=Workflow ID::${{ inputs.workflow_id }} + + - name: Output Workflow URL + run: | + repo_url="https://github.com/SumoLogic/sumologic-otel-collector" + url="${repo_url}/actions/runs/${{ inputs.workflow_id }}" + echo ::notice title=Workflow URL::${url} + + - name: Download otelcol-sumo artifact from workflow + uses: actions/download-artifact@v4 with: - fetch-depth: 0 - - name: Get version + name: otelcol-sumo-linux_amd64 + path: artifacts/ + merge-multiple: true + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ inputs.workflow_id }} + + - name: Determine version from artifact id: get-version run: | - echo "version=$(echo ${GITHUB_REF#refs/tags/v})" > $GITHUB_OUTPUT - - name: Print version - run: echo ::notice title=Version::${{ steps.get-version.outputs.version }} - - build: - name: Build - uses: ./.github/workflows/workflow-build.yml - needs: [get-version] - strategy: - matrix: - include: - - arch_os: linux_amd64 - runs-on: ubuntu-20.04 - - arch_os: linux_amd64 - runs-on: ubuntu-20.04 - fips: true - - arch_os: linux_arm64 - runs-on: ubuntu-20.04 - - arch_os: linux_arm64 - runs-on: ubuntu-20.04 - fips: true - - arch_os: darwin_amd64 - runs-on: macos-15 - - arch_os: darwin_arm64 - runs-on: macos-15 - - arch_os: windows_amd64 - runs-on: windows-2022 - - arch_os: windows_amd64 - runs-on: windows-2022 - fips: true - with: - arch_os: ${{ matrix.arch_os }} - runs-on: ${{ matrix.runs-on }} - fips: ${{ matrix.fips == true }} - sumo_component_gomod_version: "v${{ needs.get-version.outputs.version }}" - secrets: - apple_developer_certificate_p12_base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }} - apple_developer_certificate_password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} - app_store_connect_password: ${{ secrets.AC_PASSWORD }} - microsoft_certificate: ${{ secrets.MICROSOFT_CERTIFICATE }} - microsoft_certificate_password: ${{ secrets.MICROSOFT_CERTIFICATE_PASSWORD }} - microsoft_certificate_hash: ${{ secrets.MICROSOFT_CERTHASH }} - microsoft_certificate_name: ${{ secrets.MICROSOFT_CERTNAME }} - microsoft_description: ${{ secrets.MICROSOFT_DESCRIPTION }} + artifact="artifacts/otelcol-sumo-linux_amd64" + chmod +x "${artifact}" + script="ci/get_version_from_binary.sh" + core="$("$script" core "${artifact}")" + sumo="$("$script" sumo "${artifact}")" + echo "otc-version=$core" >> $GITHUB_OUTPUT + echo "sumo-version=$sumo" >> $GITHUB_OUTPUT + echo "version=${core}-sumo-${sumo}" >> $GITHUB_OUTPUT + + - name: Output Version + run: | + echo ::notice title=Version::${{ steps.get-version.outputs.version }} + + - name: Determine Git SHA of workflow + id: get-sha + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + workflow="${{ inputs.workflow_id }}" + sha="$(gh run view ${workflow} --json headSha -t '{{.headSha}}')" + echo "git-sha=$sha" >> $GITHUB_OUTPUT + + - name: Output Git SHA + run: | + echo ::notice title=Git SHA::${{ steps.get-sha.outputs.git-sha }} build-container-images: name: Build container runs-on: ubuntu-20.04 needs: - - build - get-version strategy: matrix: @@ -112,17 +109,13 @@ jobs: --username ${{ secrets.DOCKERHUB_LOGIN }} \ --password ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Download binary action artifact from build phase + - name: Download platform otelcol-sumo artifacts from workflow uses: actions/download-artifact@v4 with: - name: otelcol-sumo-${{matrix.arch_os}} - path: artifacts/ - - - name: Download binary action artifact from build phase (FIPS) - uses: actions/download-artifact@v4 - with: - name: otelcol-sumo-fips-${{matrix.arch_os}} + pattern: otelcol-sumo-*-${{ matrix.arch_os }} path: artifacts/ + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ inputs.workflow_id }} - name: Build and push FIPS image to Open Source ECR run: | @@ -196,7 +189,6 @@ jobs: needs: # Require darwin build to succeed to prevent pushing container images # when darwin build fails. - - build - build-container-images - get-version steps: @@ -282,64 +274,6 @@ jobs: REPO_URL=sumologic/sumologic-otel-collector \ BUILD_TYPE_SUFFIX="-ubi" - package-msi: - name: Package MSI - runs-on: windows-2019 - needs: - - build - strategy: - matrix: - include: - - arch_os: windows_amd64 - platform: x64 - fips: false - - arch_os: windows_amd64 - platform: x64 - fips: true - steps: - - uses: actions/checkout@v4 - - - name: Fetch current branch - run: ./ci/fetch_current_branch.sh - - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v2 - - - name: Fetch binary artifact for ${{ matrix.arch_os }} ${{ matrix.fips && '(FIPS)' || '' }} - uses: actions/download-artifact@v4 - with: - name: otelcol-sumo${{ matrix.fips && '-fips' || '' }}-windows_amd64.exe - path: ./otelcolbuilder/cmd - - - name: Rename FIPS binary artifact for ${{ matrix.arch_os }} - if: matrix.fips - working-directory: ./otelcolbuilder/cmd - run: mv otelcol-sumo${{ matrix.fips && '-fips' || '' }}-windows_amd64.exe otelcol-sumo-${{ matrix.arch_os }}.exe - - - name: Set PRODUCT_VERSION - run: echo "PRODUCT_VERSION=$(./ci/get_version.sh productversion)" >> $GITHUB_ENV - - - name: Build MSI for ${{ matrix.arch_os }} - working-directory: ./packaging/msi/wix - run: msbuild.exe -p:Configuration=Release -p:Platform=${{ matrix.platform }} -p:ProductVersion=$PRODUCT_VERSION -p:FIPSEnabled=${{ matrix.fips }} -Restore - - - name: Sign MSI - uses: skymatic/code-sign-action@v3 - with: - certificate: "${{ secrets.MICROSOFT_CERTIFICATE }}" - password: "${{ secrets.MICROSOFT_CERTIFICATE_PASSWORD }}" - certificatesha1: "${{ secrets.MICROSOFT_CERTHASH }}" - certificatename: "${{ secrets.MICROSOFT_CERTNAME }}" - description: "${{ secrets.MICROSOFT_DESCRIPTION }}" - folder: ./packaging/msi/wix/bin/${{ matrix.platform }}/en-US - - - name: Store MSI as action artifact for ${{ matrix.arch_os }} - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.arch_os }}${{ matrix.fips && '_fips' || '' }}_msi - path: ./packaging/msi/wix/bin/${{ matrix.platform }}/en-US/*.msi - if-no-files-found: error - # Store the install script from the packaging repository as a release artifact. # Originally, this script was stored in this repository, and the official download url pointed # to the most recent release here. The script has since been moved to the packaging repository. @@ -411,32 +345,42 @@ jobs: name: Create Github release runs-on: ubuntu-20.04 needs: - - build + - get-version - build-container-images - push-docker-manifest - - package-msi - - get-version steps: - - name: Download all binaries stored as artifact + - name: Download all artifacts from workflow uses: actions/download-artifact@v4 with: path: artifacts/ merge-multiple: true + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ inputs.workflow_id }} + - name: Add version to binary names working-directory: artifacts/ run: | + version="${{ needs.get-version.outputs.version }}" find . -type f -name 'otelcol-sumo*' \ - | grep -v '\.msi' \ | sed 's/^\.\///' \ | while read -r file; do - new_name=$(echo "$file" | sed 's/otelcol-sumo/otelcol-sumo-${{ needs.get-version.outputs.version }}/g') + new_name=$(echo "$file" | sed "s/otelcol-sumo/otelcol-sumo-${version}/g") + mv "$file" "$new_name" + done + find . -type f -name 'otelcol-config*' \ + | sed 's/^\.\///' \ + | while read -r file; do + new_name=$(echo "$file" | sed "s/otelcol-config/otelcol-config-${version}/g") mv "$file" "$new_name" done + - uses: ncipollo/release-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} draft: true prerelease: false + commit: ${{ needs.get-sha.outputs.git-sha }} + tag: v${{ needs.get-version.outputs.version }} allowUpdates: true omitBodyDuringUpdate: true diff --git a/.github/workflows/workflow-trigger-packaging.yml b/.github/workflows/workflow-trigger-packaging.yml index e2e2fd2665..4a50172918 100644 --- a/.github/workflows/workflow-trigger-packaging.yml +++ b/.github/workflows/workflow-trigger-packaging.yml @@ -3,14 +3,10 @@ name: Trigger Packaging on: workflow_call: inputs: - create_release: - description: The packaging workflow will create a draft release in the packaging repository. - required: true - type: boolean workflow_id: - description: ID of the workflow to fetch artifacts from. If empty, artifacts will be fetched from the latest release. + description: ID of the Collector workflow that Packaging will fetch artifacts from. type: string - required: false + required: true defaults: run: @@ -30,20 +26,6 @@ jobs: fetch-depth: 0 filter: 'tree:0' - - name: Determine version core - id: version-core - run: > - ./ci/get_version.sh core > /tmp/version_core && - cat /tmp/version_core && - echo version=$(cat /tmp/version_core) >> $GITHUB_OUTPUT - - - name: Determine sumo version - id: sumo-version - run: > - ./ci/get_version.sh sumo > /tmp/sumo_version && - cat /tmp/sumo_version && - echo version=$(cat /tmp/sumo_version) >> $GITHUB_OUTPUT - # TODO: output the workflow url - name: Trigger packaging workflow id: trigger-packaging-workflow @@ -52,12 +34,9 @@ jobs: REPO: SumoLogic/sumologic-otel-collector-packaging WORKFLOW: build_packages.yml run: | - gh workflow run --repo ${REPO} ${WORKFLOW} --json << EOF + gh workflow run --repo ${REPO} ${WORKFLOW} --ref use-binary-version --json << EOF { - "workflow_id": "${{ inputs.workflow_id }}", - "otc_version": "${{ steps.version-core.outputs.version }}", - "otc_sumo_version": "${{ steps.sumo-version.outputs.version }}", - "release": "${{ inputs.create_release }}" + "workflow_id": "${{ inputs.workflow_id }}" } EOF @@ -65,9 +44,5 @@ jobs: # packaging workflow has completed. - name: Packaging Workflow URL run: echo ::notice title=Packaging Workflow URL::https://github.com/SumoLogic/sumologic-otel-collector-packaging/actions/workflows/build_packages.yml - - name: Workflow ID - run: echo ::notice title=Workflow ID::${{ inputs.workflow_id }} - - name: OTC Version - run: echo ::notice title=OTC Version::${{ steps.version-core.outputs.version }} - - name: OTC Sumo Version - run: echo ::notice title=OTC Sumo Version::${{ steps.sumo-version.outputs.version }} + - name: Collector Workflow ID + run: echo ::notice title=Collector Workflow ID::${{ inputs.workflow_id }} diff --git a/ci/get_version.sh b/ci/get_version.sh index 318e56a18a..3ae74f1833 100755 --- a/ci/get_version.sh +++ b/ci/get_version.sh @@ -3,27 +3,24 @@ declare -i major_version declare -i minor_version declare -i patch_version -declare build_version -declare build_windows_version -declare ot_channel -declare -i ot_channel_version -declare sumo_channel -declare -i sumo_channel_version +declare -i sumo_version usage() { cat <&2 + exit 1 fi - version_regex="^v([0-9]+).([0-9]+).([0-9]+)((-(alpha|beta|rc|sumo)[-.]([0-9]+))(-(alpha|beta|rc).([0-9])+)?)?$" + version_regex="^([0-9]+).([0-9]+).([0-9]+)$" - if [[ $version_tag =~ $version_regex ]]; then + if [[ $version =~ $version_regex ]]; then major_version="${BASH_REMATCH[1]}" minor_version="${BASH_REMATCH[2]}" patch_version="${BASH_REMATCH[3]}" - ot_channel="${BASH_REMATCH[6]}" - ot_channel_version="${BASH_REMATCH[7]}" - sumo_channel="${BASH_REMATCH[9]}" - sumo_channel_version="${BASH_REMATCH[10]}" else - echo "Error: Tag does not match required version regex: ${version_tag}" >&2 + echo "Error: otc version does not match required version regex: ${version}" >&2 exit 1 fi +} - if [[ $ot_channel == "sumo" ]]; then - if [[ $sumo_channel != "" ]]; then - build_version="${ot_channel_version}-${sumo_channel}.${sumo_channel_version}" - build_windows_version="${ot_channel_version}" - else - build_version="${ot_channel_version}" - build_windows_version="${ot_channel_version}" - fi - elif [[ $ot_channel != "" ]]; then - build_version="${ot_channel_version}" - build_windows_version="${ot_channel_version}" - fi +parse_sumo_version() { + tags=() + for tag in $(git tag -l "v$(version_core)-sumo-*"); do + tags+=( "${tag}" ) + done - if [[ $OVERRIDE_BUILD_VERSION != "" ]]; then - number_regex='^[0-9]+$' - if ! [[ $OVERRIDE_BUILD_VERSION =~ $number_regex ]]; then - echo "Error: OVERRIDE_BUILD_VERSION is not a number" >&2 - exit 1 + for tag in "${tags[@]}"; do + tag_regex="^v[0-9]+.[0-9]+.[0-9]+-sumo-([0-9])+$" + if [[ $tag =~ $tag_regex ]]; then + sumo_version="${BASH_REMATCH[1]}" fi - build_version="${OVERRIDE_BUILD_VERSION}" - build_windows_version="${OVERRIDE_BUILD_VERSION}" + done + + if [[ -z "${sumo_version}" ]]; then + # No matching tags were found. Sumo version is 0. + sumo_version="0" + else + # Matching tags found. Increment sumo_version by 1. + (( sumo_version++ )) fi } # Validate version information using the Windows ProductVersion requirements. validate() { if [[ -z "${major_version}" ]]; then - echo "Major version cannot be empty" + echo "Major version cannot be empty" >&2 exit 1 fi if [[ $major_version -lt 0 ]]; then - echo "Major version cannot be less than 0" + echo "Major version cannot be less than 0" >&2 exit 1 fi if [[ $major_version -gt 255 ]]; then - echo "Major version cannot be greater than 255" + echo "Major version cannot be greater than 255" >&2 exit 1 fi if [[ -z "${minor_version}" ]]; then - echo "Minor version cannot be empty" + echo "Minor version cannot be empty" >&2 exit 1 fi if [[ $minor_version -lt 0 ]]; then - echo "Minor version cannot be less than 0" + echo "Minor version cannot be less than 0" >&2 exit 1 fi if [[ $minor_version -gt 255 ]]; then - echo "Minor version cannot be greater than 255" + echo "Minor version cannot be greater than 255" >&2 exit 1 fi - # Patch version is also known as the build version on Windows + # Patch version (known as the build version on Windows) if [[ -z "${patch_version}" ]]; then - echo "Patch version cannot be empty" + echo "Patch version cannot be empty" >&2 exit 1 fi if [[ $patch_version -lt 0 ]]; then - echo "Patch version cannot be less than 0" + echo "Patch version cannot be less than 0" >&2 exit 1 fi if [[ $patch_version -gt 65535 ]]; then - echo "Patch version cannot be greater than 65,535" - exit 1 - fi - - # Build version is also known as the internal version on Windows - if [[ -z "${build_version}" ]]; then - echo "Build version cannot be empty" - exit 1 - fi - - # Build version is also known as the internal version on Windows - if [[ -z "${build_windows_version}" ]]; then - echo "Windows Build version cannot be empty" + echo "Patch version cannot be greater than 65,535" >&2 exit 1 fi - if [[ $ot_channel_version -lt 0 ]]; then - echo "Build version cannot be less than 0" - exit 1 - fi - - if [[ $ot_channel_version -gt 65535 ]]; then - echo "Build version cannot be greater than 65,535" + # Sumo version (known as the internal version on Windows) + if [[ -z "${sumo_version}" ]]; then + echo "Sumo version cannot be empty" >&2 exit 1 fi } @@ -177,24 +156,31 @@ version_core() { # Prints the sumo version. (e.g. the X in A.B.C-sumo-X) sumo_version() { - echo "${build_version}" + echo "${sumo_version}" +} + +# Prints the full version. (e.g. A.B.C-sumo-X) +full_version() { + echo "$(version_core)-sumo-$(sumo_version)" } # Convert the version to a Windows ProductVersion. # # https://learn.microsoft.com/en-us/windows/win32/msi/productversion -# MAJOR.MINOR.PATCH.BUILD -> MAJOR.MINOR.BUILD.INTERNAL +# MAJOR.MINOR.PATCH.SUMO -> MAJOR.MINOR.BUILD.INTERNAL windows_product_version() { - echo "${major_version}.${minor_version}.${patch_version}.${build_windows_version}" + echo "${major_version}.${minor_version}.${patch_version}.${sumo_version}" } parse_params "$@" -parse_version_tag +parse_core_version +parse_sumo_version validate case "$1" in core) version_core ;; sumo) sumo_version ;; + full) full_version ;; productversion) windows_product_version ;; *) bad_usage "Unknown argument: ${1}" ;; esac diff --git a/ci/get_version_from_binary.sh b/ci/get_version_from_binary.sh new file mode 100755 index 0000000000..6a3c96f17a --- /dev/null +++ b/ci/get_version_from_binary.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +declare -i major_version +declare -i minor_version +declare -i patch_version +declare -i sumo_version + +usage() { + cat <&2 + exit 1 + fi +} + +# Prints the semver version core. (e.g. A.B.C) +version_core() { + echo "${major_version}.${minor_version}.${patch_version}" +} + +# Prints the sumo version. (e.g. the X in A.B.C-sumo-X) +version_sumo() { + echo "${sumo_version}" +} + +# Convert the version to a Windows ProductVersion. +# +# https://learn.microsoft.com/en-us/windows/win32/msi/productversion +# MAJOR.MINOR.PATCH.SUMO -> MAJOR.MINOR.BUILD.INTERNAL +windows_product_version() { + echo "${major_version}.${minor_version}.${patch_version}.${sumo_version}" +} + +parse_params "$@" +parse_version "$2" + +case "$1" in + core) version_core ;; + sumo) version_sumo ;; + productversion) windows_product_version ;; + *) bad_usage "Unknown argument: ${1}" ;; +esac diff --git a/otelcolbuilder/Makefile b/otelcolbuilder/Makefile index 5b36318408..d7237687ed 100644 --- a/otelcolbuilder/Makefile +++ b/otelcolbuilder/Makefile @@ -86,7 +86,7 @@ install-builder: .PHONY: _builder _builder: - $(eval VERSION ?= $(shell git describe --tags --abbrev=5 --match "v[0-9]*")) + $(eval VERSION ?= $(shell ./ci/get_version.sh full | xargs)-$(shell git rev-parse HEAD | xargs)) # Need to specify go path because otherwise opentelemetry-collector-builder # uses /usr/bin/go which on Github Actions is using preinstalled 1.15.12 by default. CGO_ENABLED=$(CGO_ENABLED) $(BUILDER_BIN_NAME) \ diff --git a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext.sln b/packaging/msi/SumoLogic.wixext/SumoLogic.wixext.sln deleted file mode 100644 index 9d259d8089..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext.sln +++ /dev/null @@ -1,50 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.33027.164 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SumoLogic.wixext", "SumoLogic.wixext\SumoLogic.wixext.csproj", "{C2671341-19D5-4CD6-84A3-F7207DE74E30}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SumoLogicTests", "SumoLogicTests\SumoLogicTests.csproj", "{C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Debug|Any CPU.ActiveCfg = Debug|x86 - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Debug|x64.ActiveCfg = Debug|x64 - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Debug|x64.Build.0 = Debug|x64 - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Debug|x86.ActiveCfg = Debug|x86 - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Debug|x86.Build.0 = Debug|x86 - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Release|Any CPU.Build.0 = Release|Any CPU - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Release|x64.ActiveCfg = Release|x64 - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Release|x64.Build.0 = Release|x64 - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Release|x86.ActiveCfg = Release|x64 - {C2671341-19D5-4CD6-84A3-F7207DE74E30}.Release|x86.Build.0 = Release|x64 - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Debug|x64.ActiveCfg = Debug|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Debug|x64.Build.0 = Debug|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Debug|x86.ActiveCfg = Debug|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Debug|x86.Build.0 = Debug|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Release|Any CPU.Build.0 = Release|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Release|x64.ActiveCfg = Release|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Release|x64.Build.0 = Release|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Release|x86.ActiveCfg = Release|Any CPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {AF3C92B2-597B-4A89-A66F-9B4FBD962809} - EndGlobalSection -EndGlobal diff --git a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/Config.cs b/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/Config.cs deleted file mode 100644 index d9ec4e9b5d..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/Config.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; - -namespace SumoLogic.wixext -{ - public class Config - { - public string InstallationToken { get; set; } - public Dictionary CollectorFields { get; set; } - public bool RemotelyManaged { get; set; } - public bool Ephemeral { get; set; } - public string OpAmpFolder { get; set; } - public string Api { get; set; } - - public Config() { - this.CollectorFields = new Dictionary(); - } - - public void SetCollectorFieldsFromTags(string tags) - { - if (tags.Length == 0) { return; } - - var tagsRx = new Regex(@"([^=,]+)=([^\0]+?)(?=,[^,]+=|$)", RegexOptions.Compiled); - var matches = tagsRx.Matches(tags); - - if (matches.Count == 0) - { - throw new TagsSyntaxException("tags were provided with invalid syntax"); - } - if (matches.Count > 10) - { - throw new TagsLimitExceededException("the limit of 10 tags was exceeded"); - } - - foreach (Match match in matches) - { - if (match.Groups.Count != 3) - { - Console.WriteLine("Groups: {0}", match.Groups.Count); - var msg = string.Format("invalid syntax for tag: {0}", match.Value); - throw new TagSyntaxException(msg); - } - var key = match.Groups[1].Value.Trim(); - var value = match.Groups[2].Value.Trim(); - - if (key.Length > 255) - { - var msg = string.Format("tag key exceeds maximum length of 255: {0}", key); - throw new TagKeyLengthExceededException(msg); - } - if (value.Length > 200) - { - var msg = string.Format("tag value exceeds maximum length of 200: {0}", value); - throw new TagValueLengthExceededException(msg); - } - - this.CollectorFields.Add(key, value); - } - } - } -} diff --git a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/ConfigUpdater.cs b/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/ConfigUpdater.cs deleted file mode 100644 index 3f32026f86..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/ConfigUpdater.cs +++ /dev/null @@ -1,168 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using YamlDotNet.RepresentationModel; -using YamlDotNet.Serialization; - -namespace SumoLogic.wixext -{ - public class ConfigUpdater - { - public YamlDocument Document { get; set; } - - public ConfigUpdater(StreamReader streamReader) { - try - { - var ys = new YamlStream(); - ys.Load(streamReader); - if (ys.Documents.Count == 0) - { - throw new EmptyConfigException("config file is empty"); - } - this.Document = ys.Documents[0]; - } - finally - { - streamReader.Dispose(); - } - } - - public void Update(Config config) - { - if (config.RemotelyManaged && string.IsNullOrEmpty(config.OpAmpFolder)) - { - throw new MissingConfigurationException("OpAmpFolder"); - } - - YamlMappingNode root = (YamlMappingNode)this.Document.RootNode; - - EnsureMapKey(root, "extensions"); - YamlMappingNode extensions = (YamlMappingNode)root.Children["extensions"]; - - EnsureMapKey(extensions, "sumologic"); - YamlMappingNode sumologic = (YamlMappingNode)extensions.Children["sumologic"]; - - if (config.InstallationToken != "") - { - EnsureScalarKey(sumologic, "installation_token"); - sumologic.Children["installation_token"] = config.InstallationToken; - } - - if (config.CollectorFields.Count > 0) - { - EnsureMapKey(sumologic, "collector_fields"); - YamlMappingNode collectorFields = (YamlMappingNode)sumologic.Children["collector_fields"]; - - foreach (KeyValuePair field in config.CollectorFields) - { - EnsureScalarKey(collectorFields, field.Key); - collectorFields.Children[field.Key] = field.Value; - } - } - - if (config.RemotelyManaged) - { - EnsureMapKey(extensions, "opamp"); - YamlMappingNode opamp = (YamlMappingNode)extensions.Children["opamp"]; - EnsureScalarKey(opamp, "remote_configuration_directory"); - opamp.Children["remote_configuration_directory"] = config.OpAmpFolder; - - // Add OpAmp extension to service section - EnsureMapKey(root, "service"); - YamlMappingNode service = (YamlMappingNode)root.Children["service"]; - EnsureSequenceKey(service, "extensions"); - YamlSequenceNode serviceExtensions = (YamlSequenceNode)service.Children["extensions"]; - if (!serviceExtensions.Children.Contains("opamp")) - { - serviceExtensions.Children.Add("opamp"); - } - } - - if (config.Ephemeral) - { - EnsureScalarKey(sumologic, "ephemeral"); - sumologic.Children["ephemeral"] = "true"; - } - - if (!string.IsNullOrEmpty(config.Api)) - { - EnsureScalarKey(sumologic, "api_base_url"); - sumologic.Children["api_base_url"] = config.Api; - } - - // Make sure the sumologic processor node is a map node, otherwise an empty string - // is generated as the value instead of an empty node. - if (root.Children.ContainsKey("processors")) - { - EnsureMapKey(root, "processors"); - YamlMappingNode processors = (YamlMappingNode)root.Children["processors"]; - if (processors.Children.ContainsKey("sumologic")) - { - EnsureMapKey(processors, "sumologic"); - } - } - } - - public void Save(StreamWriter streamWriter) - { - try - { - var serializer = new Serializer(); - serializer.Serialize(streamWriter, this.Document.RootNode); - } - finally - { - streamWriter.Flush(); - } - } - - private void EnsureMapKey(YamlMappingNode node, string key) - { - if (node.Children.ContainsKey(key)) - { - if (node.Children[key].NodeType == YamlNodeType.Mapping) { - return; - } - - // TODO: is this how we want to handle incorrect node types? - // YamlNode is wrong type, remove it - node.Children.Remove(key); - } - // Add empty YamlMappingNode to key - node.Children.Add(key, new YamlMappingNode()); - } - - private void EnsureScalarKey(YamlMappingNode node, string key) - { - if (node.Children.ContainsKey(key)) - { - if (node.Children[key].NodeType == YamlNodeType.Scalar) - { - return; - } - - // TODO: is this how we want to handle incorrect node types? - // YamlNode is wrong type, remove it - node.Children.Remove(key); - } - // Add empty YamlScalarNode to key - node.Children.Add(key, new YamlScalarNode()); - } - - private void EnsureSequenceKey(YamlMappingNode node, string key) - { - if (node.Children.ContainsKey(key)) - { - if (node.Children[key].NodeType == YamlNodeType.Sequence) - { - return; - } - - // TODO: is this how we want to handle incorrect node types? - // YamlNode is wrong type, remove it - node.Children.Remove(key); - } - // Add empty YamlScalarNode to key - node.Children.Add(key, new YamlSequenceNode()); - } - } -} diff --git a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/CustomAction.config b/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/CustomAction.config deleted file mode 100644 index 19bffa211e..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/CustomAction.config +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/CustomAction.cs b/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/CustomAction.cs deleted file mode 100644 index af566b9e81..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/CustomAction.cs +++ /dev/null @@ -1,138 +0,0 @@ -using System; -using System.IO; -using System.Text.RegularExpressions; -using System.Windows.Forms; -using WixToolset.Dtf.WindowsInstaller; - -namespace SumoLogic.wixext -{ - public class CustomActions - { - // WiX error codes - private const short ecMissingCustomActionData = 9001; - private const short ecConfigError = 9002; - - // WiX property names - private const string pCommonConfigPath = "CommonConfigPath"; - private const string pSumoLogicConfigPath = "SumoLogicConfigPath"; - private const string pInstallationToken = "InstallationToken"; - private const string pInstallToken = "InstallToken"; - private const string pTags = "Tags"; - private const string pApi = "Api"; - private const string pRemotelyManaged = "RemotelyManaged"; - private const string pEphemeral = "Ephemeral"; - private const string pConfigFolder = "ConfigFolder"; - private const string pOpAmpFolder = "OpAmpFolder"; - private const string pConfigFragmentsFolder = "ConfigFragmentsFolder"; - - // WiX features - private const string fRemotelyManaged = "REMOTELYMANAGED"; - - [CustomAction] - public static ActionResult UpdateConfig(Session session) - { - Logger logger = new Logger("UpdateConfig", session); - logger.Log("Begin"); - - // Validate presence of required WiX properties - if (!session.CustomActionData.ContainsKey(pCommonConfigPath)) - { - ShowErrorMessage(session, ecMissingCustomActionData, pCommonConfigPath); - return ActionResult.Failure; - } - if (!session.CustomActionData.ContainsKey(pInstallToken) && !session.CustomActionData.ContainsKey(pInstallationToken)) - { - ShowErrorMessage(session, ecMissingCustomActionData, pInstallationToken); - return ActionResult.Failure; - } - if (!session.CustomActionData.ContainsKey(pTags)) - { - ShowErrorMessage(session, ecMissingCustomActionData, pTags); - return ActionResult.Failure; - } - - var commonConfigPath = session.CustomActionData[pCommonConfigPath]; - var sumoLogicConfigPath = session.CustomActionData[pSumoLogicConfigPath]; - var tags = session.CustomActionData[pTags]; - - var installationToken = ""; - if (session.CustomActionData.ContainsKey(pInstallationToken) && session.CustomActionData[pInstallationToken] != "") - { - installationToken = session.CustomActionData[pInstallationToken]; - } - else if (session.CustomActionData.ContainsKey(pInstallToken)) - { - installationToken = session.CustomActionData[pInstallToken]; - } - - var remotelyManaged = (session.CustomActionData.ContainsKey(pRemotelyManaged) && session.CustomActionData[pRemotelyManaged] == "true"); - var ephemeral = (session.CustomActionData.ContainsKey(pEphemeral) && session.CustomActionData[pEphemeral] == "true"); - var opAmpFolder = session.CustomActionData[pOpAmpFolder]; - var api = session.CustomActionData[pApi]; - - if (remotelyManaged && string.IsNullOrEmpty(opAmpFolder)) - { - ShowErrorMessage(session, ecMissingCustomActionData, pOpAmpFolder); - return ActionResult.Failure; - } - - // Load config from disk and replace values - Config config = new Config { InstallationToken = installationToken, RemotelyManaged = remotelyManaged, Ephemeral = ephemeral, - OpAmpFolder = opAmpFolder, Api = api }; - config.SetCollectorFieldsFromTags(tags); - - var configFile = remotelyManaged ? sumoLogicConfigPath : commonConfigPath; - try - { - ConfigUpdater configUpdater = new ConfigUpdater(new StreamReader(configFile)); - configUpdater.Update(config); - configUpdater.Save(new StreamWriter(configFile)); - } - catch (Exception e) - { - ShowErrorMessage(session, ecConfigError, e.Message); - return ActionResult.Failure; - } - - logger.Log("End"); - - return ActionResult.Success; - } - - [CustomAction] - public static ActionResult PopulateServiceArguments(Session session) - { - try - { - var configFolder = session.GetTargetPath(pConfigFolder); - var configFragmentsFolder = session.GetTargetPath(pConfigFragmentsFolder); - var remotelyManaged = session.Features.Contains(fRemotelyManaged) && session.Features[fRemotelyManaged].RequestState == InstallState.Local; - - if (remotelyManaged) - { - session["SERVICEARGUMENTS"] = " --remote-config \"opamp:" + configFolder + "sumologic.yaml\""; - } - else - { - session["SERVICEARGUMENTS"] = " --config \"" + configFolder + "sumologic.yaml\" --config \"glob:" + configFragmentsFolder + "*.yaml\""; - } - } - catch (Exception e) - { - ShowErrorMessage(session, ecConfigError, e.Message + e.StackTrace); - return ActionResult.Failure; - } - - return ActionResult.Success; - } - - private static void ShowErrorMessage(Session session, short errCode, string key) - { - Record record = new Record(3); - record.SetInteger(1, errCode); - record.SetString(2, key); - session.Message(InstallMessage.Error | (InstallMessage)MessageIcon.Error, record); - record.Close(); - } - } -} diff --git a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/Exceptions.cs b/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/Exceptions.cs deleted file mode 100644 index 3c8519ad44..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/Exceptions.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace SumoLogic.wixext -{ - public class EmptyConfigException : Exception - { - public EmptyConfigException(string message) { } - } - - public class TagsSyntaxException : Exception - { - public TagsSyntaxException(string message) { } - } - - public class TagSyntaxException : Exception - { - public TagSyntaxException(string message) { } - } - - public class TagsLimitExceededException : Exception - { - public TagsLimitExceededException(string message) { } - } - - public class TagKeyLengthExceededException : Exception - { - public TagKeyLengthExceededException(string message) { } - } - - public class TagValueLengthExceededException : Exception - { - public TagValueLengthExceededException(string message) { } - } - - public class MissingConfigurationException : Exception - { - public MissingConfigurationException(string message) { } - } -} diff --git a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/Logger.cs b/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/Logger.cs deleted file mode 100644 index 5d507392fb..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/Logger.cs +++ /dev/null @@ -1,30 +0,0 @@ -using WixToolset.Dtf.WindowsInstaller; - -namespace SumoLogic.wixext -{ - class Logger - { - private string actionName; - private Session session; - - public Logger(string actionName, Session session) - { - this.actionName = actionName; - this.session = session; - } - - public void Log(string msg) - { - this.session.Log(this.Format(msg)); - } - public void Log(string format, params object[] args) - { - this.session.Log(this.Format(format), args); - } - - private string Format(string msg) - { - return string.Format("{0}: {1}", this.actionName, msg); - } - } -} diff --git a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/SumoLogic.wixext.csproj b/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/SumoLogic.wixext.csproj deleted file mode 100644 index f6ec09218f..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogic.wixext/SumoLogic.wixext.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - net35 - x64;x86;AnyCPU - - - - - - - - - - - - - - - diff --git a/packaging/msi/SumoLogic.wixext/SumoLogicTests/ConfigTests.cs b/packaging/msi/SumoLogic.wixext/SumoLogicTests/ConfigTests.cs deleted file mode 100644 index 4953c3e2f8..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogicTests/ConfigTests.cs +++ /dev/null @@ -1,90 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using SumoLogic.wixext; -using System; -using System.Linq; - -namespace SumoLogicTests -{ - [TestClass] - public class ConfigTests - { - private static readonly Random random = new Random(); - - public static string RandomString(int length) - { - const string chars = "abcdefghijklmnopqrstuvwxyz"; - return new string(Enumerable.Repeat(chars, length) - .Select(s => s[random.Next(s.Length)]).ToArray()); - } - - [TestMethod] - public void TestSetCollectorFieldsFromTags_Valid() - { - var tags = @"foo=bar,baz=kaz , xaz=yaz"; - - var config = new Config(); - config.SetCollectorFieldsFromTags(tags); - - Assert.AreEqual(config.CollectorFields.Keys.Count, 3); - - Assert.IsTrue(config.CollectorFields.ContainsKey("foo")); - Assert.IsTrue(config.CollectorFields.ContainsKey("baz")); - Assert.IsTrue(config.CollectorFields.ContainsKey("xaz")); - - Assert.AreEqual("bar", config.CollectorFields["foo"]); - Assert.AreEqual("kaz", config.CollectorFields["baz"]); - Assert.AreEqual("yaz", config.CollectorFields["xaz"]); - } - - [TestMethod] - public void TestSetCollectorFieldsFromTags_Empty() - { - var tags = @""; - - var config = new Config(); - config.SetCollectorFieldsFromTags(tags); - - Assert.AreEqual(config.CollectorFields.Keys.Count, 0); - } - - [TestMethod] - [ExpectedException(typeof(TagsSyntaxException), "Invalid tags syntax did not throw a TagsSyntaxException.")] - public void TestSetCollectorFieldsFromTags_NoMatches() - { - var tags = @"key"; - - var config = new Config(); - config.SetCollectorFieldsFromTags(tags); - } - - [TestMethod] - [ExpectedException(typeof(TagsLimitExceededException), "Tag count exceeding 10 did not throw a TagsLimitExceededException.")] - public void TestSetCollectorFieldsFromTags_LimitExceeded() - { - var tags = @"a=b,c=d,e=f,g=h,i=j,k=l,m=n,o=p,q=r,s=t,u=v"; - - var config = new Config(); - config.SetCollectorFieldsFromTags(tags); - } - - [TestMethod] - [ExpectedException(typeof(TagKeyLengthExceededException), "Tag key exceeding 255 characters did not throw a TagKeyLengthExceededException.")] - public void TestSetCollectorFieldsFromTags_KeyLengthExceeded() - { - var tags = string.Format("{0}=value", RandomString(256)); - - var config = new Config(); - config.SetCollectorFieldsFromTags(tags); - } - - [TestMethod] - [ExpectedException(typeof(TagValueLengthExceededException), "Tag value exceeding 200 characters did not throw a TagValueLengthExceededException.")] - public void TestSetCollectorFieldsFromTags_ValueLengthExceeded() - { - var tags = string.Format("key={0}", RandomString(201)); - - var config = new Config(); - config.SetCollectorFieldsFromTags(tags); - } - } -} diff --git a/packaging/msi/SumoLogic.wixext/SumoLogicTests/ConfigUpdaterTests.cs b/packaging/msi/SumoLogic.wixext/SumoLogicTests/ConfigUpdaterTests.cs deleted file mode 100644 index f812e4bab9..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogicTests/ConfigUpdaterTests.cs +++ /dev/null @@ -1,410 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using SumoLogic.wixext; -using System; -using System.IO; -using YamlDotNet.RepresentationModel; - -namespace SumoLogicTests -{ - [TestClass] - public class ConfigUpdaterTests - { - readonly string testDataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TestData"); - - public void InstallationTokenAssertions(Config config, StreamReader sr) - { - YamlStream ys = new YamlStream(); - ys.Load(sr); - YamlMappingNode root = (YamlMappingNode)ys.Documents[0].RootNode; - - Assert.IsTrue(root.Children.ContainsKey("extensions")); - Assert.AreEqual(YamlNodeType.Mapping, root.Children["extensions"].NodeType); - var extensions = (YamlMappingNode)root.Children["extensions"]; - - Assert.IsTrue(extensions.Children.ContainsKey("sumologic")); - Assert.AreEqual(YamlNodeType.Mapping, extensions.Children["sumologic"].NodeType); - var sumologic = (YamlMappingNode)extensions.Children["sumologic"]; - - Assert.IsTrue(sumologic.Children.ContainsKey("installation_token")); - Assert.AreEqual(YamlNodeType.Scalar, sumologic.Children["installation_token"].NodeType); - Assert.AreEqual(config.InstallationToken, sumologic.Children["installation_token"].ToString()); - - if (config.Ephemeral) - { - Assert.IsTrue(sumologic.Children.ContainsKey("ephemeral")); - Assert.AreEqual(YamlNodeType.Scalar, sumologic.Children["ephemeral"].NodeType); - Assert.AreEqual("true", sumologic.Children["ephemeral"].ToString()); - } - else - { - Assert.IsFalse(sumologic.Children.ContainsKey("ephemeral")); - } - - Assert.IsTrue(sumologic.Children.ContainsKey("collector_fields")); - Assert.AreEqual(YamlNodeType.Mapping, sumologic.Children["collector_fields"].NodeType); - var collectorFields = (YamlMappingNode)sumologic.Children["collector_fields"]; - - Assert.IsTrue(collectorFields.Children.ContainsKey("foo")); - Assert.IsTrue(collectorFields.Children.ContainsKey("baz")); - Assert.IsTrue(collectorFields.Children.ContainsKey("xaz")); - Assert.AreEqual(YamlNodeType.Scalar, collectorFields.Children["foo"].NodeType); - Assert.AreEqual(YamlNodeType.Scalar, collectorFields.Children["baz"].NodeType); - Assert.AreEqual(YamlNodeType.Scalar, collectorFields.Children["xaz"].NodeType); - Assert.AreEqual("bar", collectorFields.Children["foo"]); - Assert.AreEqual("kaz", collectorFields.Children["baz"]); - Assert.AreEqual("yaz", collectorFields.Children["xaz"]); - } - - public void OpAmpAssertions(Config config, StreamReader sr) - { - YamlStream ys = new YamlStream(); - ys.Load(sr); - YamlMappingNode root = (YamlMappingNode)ys.Documents[0].RootNode; - - Assert.IsTrue(root.Children.ContainsKey("extensions")); - Assert.AreEqual(YamlNodeType.Mapping, root.Children["extensions"].NodeType); - var extensions = (YamlMappingNode)root.Children["extensions"]; - - if (config.RemotelyManaged) - { - Assert.IsTrue(extensions.Children.ContainsKey("opamp")); - Assert.AreEqual(YamlNodeType.Mapping, extensions.Children["opamp"].NodeType); - var opamp = (YamlMappingNode)extensions.Children["opamp"]; - - Assert.IsTrue(opamp.Children.ContainsKey("remote_configuration_directory")); - Assert.AreEqual(YamlNodeType.Scalar, opamp.Children["remote_configuration_directory"].NodeType); - Assert.AreEqual(config.OpAmpFolder, opamp.Children["remote_configuration_directory"].ToString()); - } - else - { - Assert.IsFalse(extensions.Children.ContainsKey("opamp")); - } - - Assert.IsTrue(root.Children.ContainsKey("service")); - Assert.AreEqual(YamlNodeType.Mapping, root.Children["service"].NodeType); - var service = (YamlMappingNode)root.Children["service"]; - - Assert.IsTrue(service.Children.ContainsKey("extensions")); - Assert.AreEqual(YamlNodeType.Sequence, service.Children["extensions"].NodeType); - var serviceExtensions = (YamlSequenceNode)service.Children["extensions"]; - if (config.RemotelyManaged) - { - Assert.IsTrue(serviceExtensions.Children.Contains("opamp")); - } - else - { - Assert.IsFalse(serviceExtensions.Children.Contains("opamp")); - } - } - - public void EphemeralAssertions(Config config, StreamReader sr) - { - YamlStream ys = new YamlStream(); - ys.Load(sr); - YamlMappingNode root = (YamlMappingNode)ys.Documents[0].RootNode; - - Assert.IsTrue(root.Children.ContainsKey("extensions")); - Assert.AreEqual(YamlNodeType.Mapping, root.Children["extensions"].NodeType); - var extensions = (YamlMappingNode)root.Children["extensions"]; - - Assert.IsTrue(extensions.Children.ContainsKey("sumologic")); - Assert.AreEqual(YamlNodeType.Mapping, extensions.Children["sumologic"].NodeType); - var sumologic = (YamlMappingNode)extensions.Children["sumologic"]; - - if (config.Ephemeral) - { - Assert.IsTrue(sumologic.Children.ContainsKey("ephemeral")); - Assert.AreEqual(YamlNodeType.Scalar, sumologic.Children["ephemeral"].NodeType); - Assert.AreEqual("true", sumologic.Children["ephemeral"].ToString()); - } - else - { - if (sumologic.Children.ContainsKey("ephemeral")) - { - Assert.AreEqual(YamlNodeType.Scalar, sumologic.Children["ephemeral"].NodeType); - Assert.AreEqual("false", sumologic.Children["ephemeral"].ToString()); - } - } - } - - public void ApiAssertions(Config config, StreamReader sr) - { - YamlStream ys = new YamlStream(); - ys.Load(sr); - YamlMappingNode root = (YamlMappingNode)ys.Documents[0].RootNode; - - Assert.IsTrue(root.Children.ContainsKey("extensions")); - Assert.AreEqual(YamlNodeType.Mapping, root.Children["extensions"].NodeType); - var extensions = (YamlMappingNode)root.Children["extensions"]; - - Assert.IsTrue(extensions.Children.ContainsKey("sumologic")); - Assert.AreEqual(YamlNodeType.Mapping, extensions.Children["sumologic"].NodeType); - var sumologic = (YamlMappingNode)extensions.Children["sumologic"]; - - Assert.IsTrue(sumologic.Children.ContainsKey("api_base_url")); - Assert.AreEqual(YamlNodeType.Scalar, sumologic.Children["api_base_url"].NodeType); - var apiBaseUrl = (YamlScalarNode)sumologic.Children["api_base_url"]; - Assert.AreEqual(config.Api, apiBaseUrl.ToString()); - } - - [TestMethod] - public void TestUpdate_WithExtensionsBlock() - { - var filePath = Path.Combine(testDataPath, "with-extensions-block.yaml"); - var config = new Config { InstallationToken = "foobar", Ephemeral = true }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - configUpdater.Update(config); - configUpdater.Save(new StreamWriter(ms)); - - ms.Seek(0, SeekOrigin.Begin); - - StreamReader sr = new StreamReader(ms); - while (!sr.EndOfStream) - { - Console.WriteLine(sr.ReadLine()); - } - - ms.Seek(0, SeekOrigin.Begin); - - InstallationTokenAssertions(config, sr); - } - } - - [TestMethod] - public void TestUpdate_WithoutExtensionsBlock() - { - var filePath = Path.Combine(testDataPath, "without-extensions-block.yaml"); - var config = new Config { InstallationToken = "foobar", Ephemeral = false }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - configUpdater.Update(config); - configUpdater.Save(new StreamWriter(ms)); - - ms.Seek(0, SeekOrigin.Begin); - - StreamReader sr = new StreamReader(ms); - while (!sr.EndOfStream) - { - Console.WriteLine(sr.ReadLine()); - } - - ms.Seek(0, SeekOrigin.Begin); - - InstallationTokenAssertions(config, sr); - } - } - - [TestMethod] - public void TestUpdate_NoIndentation() - { - var filePath = Path.Combine(testDataPath, "no-indentation.yaml"); - var config = new Config { InstallationToken = "foobar" }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - configUpdater.Update(config); - configUpdater.Save(new StreamWriter(ms)); - - ms.Seek(0, SeekOrigin.Begin); - - StreamReader sr = new StreamReader(ms); - while (!sr.EndOfStream) - { - Console.WriteLine(sr.ReadLine()); - } - - ms.Seek(0, SeekOrigin.Begin); - - InstallationTokenAssertions(config, sr); - } - } - - [TestMethod] - [ExpectedException(typeof(EmptyConfigException), "Loading an empty config did not throw an EmptyConfigException.")] - public void TestUpdate_Empty() - { - var filePath = Path.Combine(testDataPath, "empty.yaml"); - var config = new Config { InstallationToken = "foobar" }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - } - } - - [TestMethod] - [ExpectedException(typeof(YamlDotNet.Core.SyntaxErrorException), "Loading an invalid config did not throw a YamlDotNet.Core.SyntaxErrorException.")] - public void TestUpdate_Invalid() - { - var filePath = Path.Combine(testDataPath, "invalid.yaml"); - var config = new Config { InstallationToken = "foobar" }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - } - } - - [TestMethod] - public void TestUpdate_OpAmp() - { - var filePath = Path.Combine(testDataPath, "with-extensions-block.yaml"); - var config = new Config { InstallationToken = "foobar", Ephemeral = true, RemotelyManaged = true, OpAmpFolder = "/opamp" }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - configUpdater.Update(config); - configUpdater.Save(new StreamWriter(ms)); - - ms.Seek(0, SeekOrigin.Begin); - - StreamReader sr = new StreamReader(ms); - while (!sr.EndOfStream) - { - Console.WriteLine(sr.ReadLine()); - } - - ms.Seek(0, SeekOrigin.Begin); - - OpAmpAssertions(config, sr); - } - } - - [TestMethod] - [ExpectedException(typeof(MissingConfigurationException), "OpAmpFolder")] - public void TestUpdate_OpAmpNoFolder() - { - var filePath = Path.Combine(testDataPath, "with-extensions-block.yaml"); - var config = new Config { InstallationToken = "foobar", Ephemeral = true, RemotelyManaged = true }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - configUpdater.Update(config); - configUpdater.Save(new StreamWriter(ms)); - } - } - - [TestMethod] - public void TestUpdate_NoOpAmpWithFolder() - { - var filePath = Path.Combine(testDataPath, "with-extensions-block.yaml"); - var config = new Config { InstallationToken = "foobar", Ephemeral = true, RemotelyManaged = false, OpAmpFolder = "/opamp" }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - configUpdater.Update(config); - configUpdater.Save(new StreamWriter(ms)); - - ms.Seek(0, SeekOrigin.Begin); - - StreamReader sr = new StreamReader(ms); - while (!sr.EndOfStream) - { - Console.WriteLine(sr.ReadLine()); - } - - ms.Seek(0, SeekOrigin.Begin); - - OpAmpAssertions(config, sr); - } - } - - [TestMethod] - public void TestUpdate_Ephemeral() - { - var filePath = Path.Combine(testDataPath, "with-extensions-block.yaml"); - var config = new Config { InstallationToken = "foobar", Ephemeral = true }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - configUpdater.Update(config); - configUpdater.Save(new StreamWriter(ms)); - - ms.Seek(0, SeekOrigin.Begin); - - StreamReader sr = new StreamReader(ms); - while (!sr.EndOfStream) - { - Console.WriteLine(sr.ReadLine()); - } - - ms.Seek(0, SeekOrigin.Begin); - - EphemeralAssertions(config, sr); - } - } - - [TestMethod] - public void TestUpdate_NotEphemeral() - { - var filePath = Path.Combine(testDataPath, "with-extensions-block.yaml"); - var config = new Config { InstallationToken = "foobar", Ephemeral = false }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - configUpdater.Update(config); - configUpdater.Save(new StreamWriter(ms)); - - ms.Seek(0, SeekOrigin.Begin); - - StreamReader sr = new StreamReader(ms); - while (!sr.EndOfStream) - { - Console.WriteLine(sr.ReadLine()); - } - - ms.Seek(0, SeekOrigin.Begin); - - EphemeralAssertions(config, sr); - } - } - - [TestMethod] - public void TestUpdate_Api() - { - var filePath = Path.Combine(testDataPath, "with-extensions-block.yaml"); - var config = new Config { InstallationToken = "foobar", Api = "http://apiurl.local" }; - config.SetCollectorFieldsFromTags(@"foo=bar,baz=kaz,xaz=yaz"); - - using (MemoryStream ms = new MemoryStream()) - { - var configUpdater = new ConfigUpdater(new StreamReader(filePath)); - configUpdater.Update(config); - configUpdater.Save(new StreamWriter(ms)); - - ms.Seek(0, SeekOrigin.Begin); - - StreamReader sr = new StreamReader(ms); - while (!sr.EndOfStream) - { - Console.WriteLine(sr.ReadLine()); - } - - ms.Seek(0, SeekOrigin.Begin); - - ApiAssertions(config, sr); - } - } - } -} diff --git a/packaging/msi/SumoLogic.wixext/SumoLogicTests/Properties/AssemblyInfo.cs b/packaging/msi/SumoLogic.wixext/SumoLogicTests/Properties/AssemblyInfo.cs deleted file mode 100644 index 08b3c70bcb..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogicTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("SumoLogicTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SumoLogicTests")] -[assembly: AssemblyCopyright("Copyright © 2022")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -[assembly: ComVisible(false)] - -[assembly: Guid("c2b5b3eb-dbd0-4bd2-a90e-d4f2f1a615bc")] - -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/packaging/msi/SumoLogic.wixext/SumoLogicTests/SumoLogicTests.csproj b/packaging/msi/SumoLogic.wixext/SumoLogicTests/SumoLogicTests.csproj deleted file mode 100644 index f83f8d9f4e..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogicTests/SumoLogicTests.csproj +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - Debug - AnyCPU - {C2B5B3EB-DBD0-4BD2-A90E-D4F2F1A615BC} - Library - Properties - SumoLogicTests - SumoLogicTests - v4.5.1 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 15.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - - - - - 15.0 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - MinimumRecommendedRules.ruleset - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - MinimumRecommendedRules.ruleset - false - AnyCPU - - - - ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll - - - ..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll - - - - - ..\packages\YamlDotNet.12.0.2\lib\net45\YamlDotNet.dll - - - - - - - - - - {c2671341-19d5-4cd6-84a3-f7207de74e30} - SumoLogic.wixext - - - - - - Always - - - Always - - - Always - - - Always - - - Always - - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - diff --git a/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/empty.yaml b/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/empty.yaml deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/invalid.yaml b/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/invalid.yaml deleted file mode 100644 index bf1ee551ce..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/invalid.yaml +++ /dev/null @@ -1 +0,0 @@ -"invalid-yaml: foobar diff --git a/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/no-indentation.yaml b/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/no-indentation.yaml deleted file mode 100644 index d01f538872..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/no-indentation.yaml +++ /dev/null @@ -1,11 +0,0 @@ -## This file is generated automatically and shouldn't be changed -## All modifications should be put as separate files in conf.d subdirectory -extensions: - -receivers: - -exporters: - -processors: - -service: diff --git a/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/with-extensions-block.yaml b/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/with-extensions-block.yaml deleted file mode 100644 index 67581a6b61..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/with-extensions-block.yaml +++ /dev/null @@ -1,104 +0,0 @@ -## This file is generated automatically and shouldn't be changed -## All modifications should be put as separate files in conf.d subdirectory -extensions: - ## Configuration for Sumo Logic Extension - ## Manages registration, heartbeats and authentication to Sumo Logic - ## ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/sumologicextension - sumologic: - installation_token: ${SUMOLOGIC_INSTALLATION_TOKEN} - collector_credentials_directory: ${PROGRAMDATA}\Sumo Logic\otelcol-sumo\data\credentials - - ## Configuration for Health Check Extension - ## Health Check extension enables an HTTP url that can be probed to check the status of the OpenTelemetry Collector - ## ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/healthcheckextension - health_check: - - ## Configuration for File Storage Extension - ## The File Storage extension can persist state to the local file system - ## ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/storage/filestorage - file_storage: - directory: ${PROGRAMDATA}\Sumo Logic\otelcol-sumo\data\file_storage - -receivers: - ## Configuration for OTLP Receiver - ## Receives data via gRPC or HTTP using OTLP format. - ## ref: https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver - otlp: - protocols: - grpc: - endpoint: localhost:4317 - http: - endpoint: localhost:4318 - -exporters: - ## Configuration for Sumo Logic Exporter - ## This exporter supports sending logs, metrics and traces data to Sumo Logic. - ## ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.103.0/exporter/sumologicexporter - sumologic: - sending_queue: - enabled: true - storage: file_storage - -processors: - ## Configuration for Memory Limiter Processor - ## The memory_limiter processor is used to prevent out of memory situations on the collector. - ## ref: https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/memorylimiterprocessor - memory_limiter: - ## check_interval is the time between measurements of memory usage for the - ## purposes of avoiding going over the limits. Defaults to zero, so no - ## checks will be performed. Values below 1 second are not recommended since - ## it can result in unnecessary CPU consumption. - check_interval: 5s - ## Maximum amount of memory, in %, targeted to be allocated by the process heap. - limit_percentage: 75 - ## Spike limit (calculated from available memory). Must be less than limit_percentage. - spike_limit_percentage: 20 - - ## Configuration for Batch Processor - ## The batch processor accepts records and places them into batches grouped by node and resource - ## ref: https://github.com/open-telemetry/opentelemetry-collector/blob/main/processor/batchprocessor - batch: - ## Number of records after which a batch will be sent regardless of time - send_batch_size: 1_024 - ## Time duration after which a batch will be sent regardless of size - timeout: 1s - - ## Configuration for Sumo Logic Schema Processor - ## The Sumo Logic Schema processor modifies the metadata on logs, metrics and traces sent to Sumo Logic - ## so that the Sumo Logic apps can make full use of the ingested data. - ## ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/sumologicprocessor - sumologic: - -service: - extensions: - - sumologic - - health_check - - file_storage - pipelines: - metrics/default: - receivers: - - otlp - processors: - - memory_limiter - - batch - - sumologic - exporters: - - sumologic - logs/default: - receivers: - - otlp - processors: - - memory_limiter - - batch - - sumologic - exporters: - - sumologic - traces/default: - receivers: - - otlp - processors: - - memory_limiter - - batch - - sumologic - exporters: - - sumologic diff --git a/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/without-extensions-block.yaml b/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/without-extensions-block.yaml deleted file mode 100644 index f1b0ea41d6..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogicTests/TestData/without-extensions-block.yaml +++ /dev/null @@ -1,85 +0,0 @@ -## This file is generated automatically and shouldn't be changed -## All modifications should be put as separate files in conf.d subdirectory -receivers: - ## Configuration for OTLP Receiver - ## Receives data via gRPC or HTTP using OTLP format. - ## ref: https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver/otlpreceiver - otlp: - protocols: - grpc: - endpoint: localhost:4317 - http: - endpoint: localhost:4318 - -exporters: - ## Configuration for Sumo Logic Exporter - ## This exporter supports sending logs, metrics and traces data to Sumo Logic. - ## ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/v0.103.0/exporter/sumologicexporter - sumologic: - sending_queue: - enabled: true - storage: file_storage - -processors: - ## Configuration for Memory Limiter Processor - ## The memory_limiter processor is used to prevent out of memory situations on the collector. - ## ref: https://github.com/open-telemetry/opentelemetry-collector/tree/main/processor/memorylimiterprocessor - memory_limiter: - ## check_interval is the time between measurements of memory usage for the - ## purposes of avoiding going over the limits. Defaults to zero, so no - ## checks will be performed. Values below 1 second are not recommended since - ## it can result in unnecessary CPU consumption. - check_interval: 5s - ## Maximum amount of memory, in %, targeted to be allocated by the process heap. - limit_percentage: 75 - ## Spike limit (calculated from available memory). Must be less than limit_percentage. - spike_limit_percentage: 20 - - ## Configuration for Batch Processor - ## The batch processor accepts records and places them into batches grouped by node and resource - ## ref: https://github.com/open-telemetry/opentelemetry-collector/blob/main/processor/batchprocessor - batch: - ## Number of records after which a batch will be sent regardless of time - send_batch_size: 1_024 - ## Time duration after which a batch will be sent regardless of size - timeout: 1s - - ## Configuration for Sumo Logic Schema Processor - ## The Sumo Logic Schema processor modifies the metadata on logs, metrics and traces sent to Sumo Logic - ## so that the Sumo Logic apps can make full use of the ingested data. - ## ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/sumologicprocessor - sumologic: - -service: - extensions: - - sumologic - - health_check - - file_storage - pipelines: - metrics/default: - receivers: - - otlp - processors: - - memory_limiter - - batch - - sumologic - exporters: - - sumologic - logs/default: - receivers: - - otlp - processors: - - memory_limiter - - batch - - sumologic - exporters: - - sumologic - traces/default: - receivers: - - otlp - processors: - - memory_limiter - - batch - - sumologic - exporters: - - sumologic diff --git a/packaging/msi/SumoLogic.wixext/SumoLogicTests/packages.config b/packaging/msi/SumoLogic.wixext/SumoLogicTests/packages.config deleted file mode 100644 index 673ede4a7d..0000000000 --- a/packaging/msi/SumoLogic.wixext/SumoLogicTests/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/packaging/msi/wix/assets/LICENSE.rtf b/packaging/msi/wix/assets/LICENSE.rtf deleted file mode 100644 index 0184c5c42a..0000000000 --- a/packaging/msi/wix/assets/LICENSE.rtf +++ /dev/null @@ -1,236 +0,0 @@ -{\rtf1\ansi\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Courier New;}} -{\*\generator Riched20 10.0.22000}\viewkind4\uc1 -\pard\f0\fs22\lang1033 Copyright 2021 Sumo Logic Inc.\par -\par - -\pard\qc Apache License\par -Version 2.0, January 2004\par -http://www.apache.org/licenses/\par - -\pard\par - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\par -\par - 1. Definitions.\par -\par - "License" shall mean the terms and conditions for use, reproduction,\par - and distribution as defined by Sections 1 through 9 of this document.\par -\par - "Licensor" shall mean the copyright owner or entity authorized by\par - the copyright owner that is granting the License.\par -\par - "Legal Entity" shall mean the union of the acting entity and all\par - other entities that control, are controlled by, or are under common\par - control with that entity. For the purposes of this definition,\par - "control" means (i) the power, direct or indirect, to cause the\par - direction or management of such entity, whether by contract or\par - otherwise, or (ii) ownership of fifty percent (50%) or more of the\par - outstanding shares, or (iii) beneficial ownership of such entity.\par -\par - "You" (or "Your") shall mean an individual or Legal Entity\par - exercising permissions granted by this License.\par -\par - "Source" form shall mean the preferred form for making modifications,\par - including but not limited to software source code, documentation\par - source, and configuration files.\par -\par - "Object" form shall mean any form resulting from mechanical\par - transformation or translation of a Source form, including but\par - not limited to compiled object code, generated documentation,\par - and conversions to other media types.\par -\par - "Work" shall mean the work of authorship, whether in Source or\par - Object form, made available under the License, as indicated by a\par - copyright notice that is included in or attached to the work\par - (an example is provided in the Appendix below).\par -\par - "Derivative Works" shall mean any work, whether in Source or Object\par - form, that is based on (or derived from) the Work and for which the\par - editorial revisions, annotations, elaborations, or other modifications\par - represent, as a whole, an original work of authorship. For the purposes\par - of this License, Derivative Works shall not include works that remain\par - separable from, or merely link (or bind by name) to the interfaces of,\par - the Work and Derivative Works thereof.\par -\par - "Contribution" shall mean any work of authorship, including\par - the original version of the Work and any modifications or additions\par - to that Work or Derivative Works thereof, that is intentionally\par - submitted to Licensor for inclusion in the Work by the copyright owner\par - or by an individual or Legal Entity authorized to submit on behalf of\par - the copyright owner. For the purposes of this definition, "submitted"\par - means any form of electronic, verbal, or written communication sent\par - to the Licensor or its representatives, including but not limited to\par - communication on electronic mailing lists, source code control systems,\par - and issue tracking systems that are managed by, or on behalf of, the\par - Licensor for the purpose of discussing and improving the Work, but\par - excluding communication that is conspicuously marked or otherwise\par - designated in writing by the copyright owner as "Not a Contribution."\par -\par - "Contributor" shall mean Licensor and any individual or Legal Entity\par - on behalf of whom a Contribution has been received by Licensor and\par - subsequently incorporated within the Work.\par -\par - 2. Grant of Copyright License. Subject to the terms and conditions of\par - this License, each Contributor hereby grants to You a perpetual,\par - worldwide, non-exclusive, no-charge, royalty-free, irrevocable\par - copyright license to reproduce, prepare Derivative Works of,\par - publicly display, publicly perform, sublicense, and distribute the\par - Work and such Derivative Works in Source or Object form.\par -\par - 3. Grant of Patent License. Subject to the terms and conditions of\par - this License, each Contributor hereby grants to You a perpetual,\par - worldwide, non-exclusive, no-charge, royalty-free, irrevocable\par - (except as stated in this section) patent license to make, have made,\par - use, offer to sell, sell, import, and otherwise transfer the Work,\par - where such license applies only to those patent claims licensable\par - by such Contributor that are necessarily infringed by their\par - Contribution(s) alone or by combination of their Contribution(s)\par - with the Work to which such Contribution(s) was submitted. If You\par - institute patent litigation against any entity (including a\par - cross-claim or counterclaim in a lawsuit) alleging that the Work\par - or a Contribution incorporated within the Work constitutes direct\par - or contributory patent infringement, then any patent licenses\par - granted to You under this License for that Work shall terminate\par - as of the date such litigation is filed.\par -\par - 4. Redistribution. You may reproduce and distribute copies of the\par - Work or Derivative Works thereof in any medium, with or without\par - modifications, and in Source or Object form, provided that You\par - meet the following conditions:\par -\par - (a) You must give any other recipients of the Work or\par - Derivative Works a copy of this License; and\par -\par - (b) You must cause any modified files to carry prominent notices\par - stating that You changed the files; and\par -\par - (c) You must retain, in the Source form of any Derivative Works\par - that You distribute, all copyright, patent, trademark, and\par - attribution notices from the Source form of the Work,\par - excluding those notices that do not pertain to any part of\par - the Derivative Works; and\par -\par - (d) If the Work includes a "NOTICE" text file as part of its\par - distribution, then any Derivative Works that You distribute must\par - include a readable copy of the attribution notices contained\par - within such NOTICE file, excluding those notices that do not\par - pertain to any part of the Derivative Works, in at least one\par - of the following places: within a NOTICE text file distributed\par - as part of the Derivative Works; within the Source form or\par - documentation, if provided along with the Derivative Works; or,\par - within a display generated by the Derivative Works, if and\par - wherever such third-party notices normally appear. The contents\par - of the NOTICE file are for informational purposes only and\par - do not modify the License. You may add Your own attribution\par - notices within Derivative Works that You distribute, alongside\par - or as an addendum to the NOTICE text from the Work, provided\par - that such additional attribution notices cannot be construed\par - as modifying the License.\par -\par - You may add Your own copyright statement to Your modifications and\par - may provide additional or different license terms and conditions\par - for use, reproduction, or distribution of Your modifications, or\par - for any such Derivative Works as a whole, provided Your use,\par - reproduction, and distribution of the Work otherwise complies with\par - the conditions stated in this License.\par -\par - 5. Submission of Contributions. Unless You explicitly state otherwise,\par - any Contribution intentionally submitted for inclusion in the Work\par - by You to the Licensor shall be under the terms and conditions of\par - this License, without any additional terms or conditions.\par - Notwithstanding the above, nothing herein shall supersede or modify\par - the terms of any separate license agreement you may have executed\par - with Licensor regarding such Contributions.\par -\par - 6. Trademarks. This License does not grant permission to use the trade\par - names, trademarks, service marks, or product names of the Licensor,\par - except as required for reasonable and customary use in describing the\par - origin of the Work and reproducing the content of the NOTICE file.\par -\par - 7. Disclaimer of Warranty. Unless required by applicable law or\par - agreed to in writing, Licensor provides the Work (and each\par - Contributor provides its Contributions) on an "AS IS" BASIS,\par - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\par - implied, including, without limitation, any warranties or conditions\par - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\par - PARTICULAR PURPOSE. You are solely responsible for determining the\par - appropriateness of using or redistributing the Work and assume any\par - risks associated with Your exercise of permissions under this License.\par -\par - 8. Limitation of Liability. In no event and under no legal theory,\par - whether in tort (including negligence), contract, or otherwise,\par - unless required by applicable law (such as deliberate and grossly\par - negligent acts) or agreed to in writing, shall any Contributor be\par - liable to You for damages, including any direct, indirect, special,\par - incidental, or consequential damages of any character arising as a\par - result of this License or out of the use or inability to use the\par - Work (including but not limited to damages for loss of goodwill,\par - work stoppage, computer failure or malfunction, or any and all\par - other commercial damages or losses), even if such Contributor\par - has been advised of the possibility of such damages.\par -\par - 9. Accepting Warranty or Additional Liability. While redistributing\par - the Work or Derivative Works thereof, You may choose to offer,\par - and charge a fee for, acceptance of support, warranty, indemnity,\par - or other liability obligations and/or rights consistent with this\par - License. However, in accepting such obligations, You may act only\par - on Your own behalf and on Your sole responsibility, not on behalf\par - of any other Contributor, and only if You agree to indemnify,\par - defend, and hold each Contributor harmless for any liability\par - incurred by, or claims asserted against, such Contributor by reason\par - of your accepting any such warranty or additional liability.\par -\par - END OF TERMS AND CONDITIONS\par -\par - APPENDIX: How to apply the Apache License to your work.\par -\par - To apply the Apache License to your work, attach the following\par - boilerplate notice, with the fields enclosed by brackets "[]"\par - replaced with your own identifying information. (Don't include\par - the brackets!) The text should be enclosed in the appropriate\par - comment syntax for the file format. We also recommend that a\par - file or class name and description of purpose be included on the\par - same "printed page" as the copyright notice for easier\par - identification within third-party archives.\par -\par - Copyright 2021 Sumo Logic Inc.\par -\par - Licensed under the Apache License, Version 2.0 (the "License");\par - you may not use this file except in compliance with the License.\par - You may obtain a copy of the License at\par -\par - http://www.apache.org/licenses/LICENSE-2.0\par -\par - Unless required by applicable law or agreed to in writing, software\par - distributed under the License is distributed on an "AS IS" BASIS,\par - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\par - See the License for the specific language governing permissions and\par - limitations under the License.\par -\par -Contains code from https://github.com/SumoLogic/telegraf/blob/master/LICENSE\par -under the MIT license in the following directory:\par -https://github.com/SumoLogic/sumologic-otel-collector/tree/main/pkg/receiver/telegrafreceiver\par -\par -The MIT License (MIT)\par -\par -Copyright (c) 2015-2020 InfluxData Inc.\par -\par -Permission is hereby granted, free of charge, to any person obtaining a copy\par -of this software and associated documentation files (the "Software"), to deal\par -in the Software without restriction, including without limitation the rights\par -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\par -copies of the Software, and to permit persons to whom the Software is\par -furnished to do so, subject to the following conditions:\par -\par -The above copyright notice and this permission notice shall be included in all\par -copies or substantial portions of the Software.\par -\par -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\par -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\par -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\par -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\par -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\par -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\par -SOFTWARE.\par -\par -} - diff --git a/packaging/msi/wix/assets/banner_background.bmp b/packaging/msi/wix/assets/banner_background.bmp deleted file mode 100644 index 8ea0a1292a..0000000000 Binary files a/packaging/msi/wix/assets/banner_background.bmp and /dev/null differ diff --git a/packaging/msi/wix/assets/common.yaml b/packaging/msi/wix/assets/common.yaml deleted file mode 100644 index 3e7d24c60a..0000000000 --- a/packaging/msi/wix/assets/common.yaml +++ /dev/null @@ -1,3 +0,0 @@ -extensions: - sumologic: - installation_token: diff --git a/packaging/msi/wix/assets/dialog_background.bmp b/packaging/msi/wix/assets/dialog_background.bmp deleted file mode 100644 index aff274fd2a..0000000000 Binary files a/packaging/msi/wix/assets/dialog_background.bmp and /dev/null differ diff --git a/packaging/msi/wix/assets/project.ico b/packaging/msi/wix/assets/project.ico deleted file mode 100644 index 47c2661bb9..0000000000 Binary files a/packaging/msi/wix/assets/project.ico and /dev/null differ diff --git a/packaging/msi/wix/components.wxs b/packaging/msi/wix/components.wxs deleted file mode 100644 index 0e06dd1f40..0000000000 --- a/packaging/msi/wix/components.wxs +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/msi/wix/folders.wxs b/packaging/msi/wix/folders.wxs deleted file mode 100644 index 35d209252b..0000000000 --- a/packaging/msi/wix/folders.wxs +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/msi/wix/otelcol-sumo.wixproj b/packaging/msi/wix/otelcol-sumo.wixproj deleted file mode 100644 index e538f9fb35..0000000000 --- a/packaging/msi/wix/otelcol-sumo.wixproj +++ /dev/null @@ -1,68 +0,0 @@ - - - - 1.0.0.0 - 25ec8859-fe5e-4110-a6e4-915b6ed83072 - 33D8E84A-1581-41DC-AF17-E48459B895C5 - en-US - none - $([System.IO.Path]::GetFullPath('..\..\..')) - false - - - - ICE61 - - - - bin\$(Platform)\ - obj\$(Platform)\ - - - - otelcol-sumo_$(ProductVersion)_en-US.$(Platform) - - - - otelcol-sumo_$(ProductVersion)_en-US.$(Platform)-fips - - - - $(DefineConstants);ProductVersion=$(ProductVersion) - $(DefineConstants);UpgradeCode=$(UpgradeCode) - - - - - - - - - - - SumoLogic - - - - - - - - - - - - - - - true - - - - - - - - - - diff --git a/packaging/msi/wix/package.en-us.wxl b/packaging/msi/wix/package.en-us.wxl deleted file mode 100644 index b677409a10..0000000000 --- a/packaging/msi/wix/package.en-us.wxl +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/msi/wix/package.wxs b/packaging/msi/wix/package.wxs deleted file mode 100644 index 4903853990..0000000000 --- a/packaging/msi/wix/package.wxs +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/msi/wix/ui/appdata-dir-dlg.wxs b/packaging/msi/wix/ui/appdata-dir-dlg.wxs deleted file mode 100644 index 5736fc8de1..0000000000 --- a/packaging/msi/wix/ui/appdata-dir-dlg.wxs +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/msi/wix/ui/otelcol-sumo.wxs b/packaging/msi/wix/ui/otelcol-sumo.wxs deleted file mode 100644 index 73765b66af..0000000000 --- a/packaging/msi/wix/ui/otelcol-sumo.wxs +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packaging/msi/wix/variables.wxi b/packaging/msi/wix/variables.wxi deleted file mode 100644 index 2b6c3ba33f..0000000000 --- a/packaging/msi/wix/variables.wxi +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - -