Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopts the orca testing into the releaser pipeline CI/CD. #5867

Merged
merged 18 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# See https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings#example
*.cmd text eol=crlf
*.ps1 text eol=crlf
16 changes: 15 additions & 1 deletion .github/workflows/splunk-ta-otel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,18 @@ jobs:
set -o pipefail
make -e bundle.d otelcol generate-technical-addon copy-local-build-to-ta package-ta
make -e discovery-test-ta

spell-check:
name: spell-check
runs-on: ubuntu-latest
needs: [setup-environment]
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
with:
sparse-checkout: packaging/technical-addon/
- uses: streetsidesoftware/cspell-action@v6
with:
config: packaging/technical-addon/packaging-scripts/cspell/cspell.json
root: packaging/technical-addon/Splunk_TA_otel
files: |
!**/agent-bundle/**
97 changes: 96 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
default:
image: '${DOCKER_CICD_REPO}/ci-container/debian-bookworm:3.5.0'
hughesjj marked this conversation as resolved.
Show resolved Hide resolved
image: "${DOCKER_CICD_REPO}/ci-container/debian-bookworm:3.5.0"
id_tokens:
CI_JOB_JWT:
aud:
- "$CICD_VAULT_ADDR"
- "$SECRETS_URL"

variables:
WIN_2019_BASE_IMAGE: mcr.microsoft.com/windows/servercore:ltsc2019
WIN_2022_BASE_IMAGE: mcr.microsoft.com/windows/servercore:ltsc2022
SPLUNK_OTELCOL_DOWNLOAD_BASE:
value: "https://github.com/signalfx/splunk-otel-collector/releases/download"
description: 'URL to download artifacts from'
BUILD_DIR:
value: '${CI_PROJECT_DIR}/build'
description: 'in this CI, where builds are stored'

stages:
- update-deps
- sast-oss-scan
- build
- sign-binaries
- package
- code-analysis
- orca-tests
- sign-packages
- release
- docker-manifest-release
Expand Down Expand Up @@ -412,6 +425,88 @@ agent-bundle-windows:
paths:
- dist/agent-bundle_windows_amd64.zip

.auth-setup:
variables:
TEST_FOLDER: $BUILD_DIR/$CI_JOB_ID
before_script: |
creds-helper init
creds-helper pypi "$PYPI_READER_ROLE"
eval "$(creds-helper artifactory --eval "$PYPI_READER_ROLE" )"
pip install --upgrade pip
pip install --upgrade splunk-orca
splunk_orca --help
pushd ~
echo ${ORCA_TAR_GZ} | base64 -d > orca_cred.tar.gz
tar -xzvf ~/orca_cred.tar.gz
echo "area = otel-collector" >> ~/.orca/orca.conf
popd

package-technical-addon:
image: "${DOCKER_CICD_REPO}/ci-container/python-3.11-bullseye:1.19.0"
stage: "package"
script: |
make distribute-ta -e
artifacts:
paths:
- "$BUILD_DIR/out/distribution/Splunk_TA_otel*.tgz"
- "$BUILD_DIR/packaging-scripts"
- "$BUILD_DIR/Makefile"
parallel:
matrix:
- PLATFORM: ["all"]

test-happypath-ta:
image: "${DOCKER_CICD_REPO}/ci-container/python-3.11-bullseye:1.19.0"
extends: .auth-setup
stage: orca-tests
dependencies:
- "package-technical-addon"
parallel:
matrix:
- UF_VERSION: ["9.0.2", "8.2.7"]
pjanotti marked this conversation as resolved.
Show resolved Hide resolved
SPLUNK_PLATFORM: ["x64_centos_7"]
ORCA_CLOUD: ["aws"]
ORCA_OPTION: [""]
PLATFORM: ["linux"]
- UF_VERSION: ["9.0.2", "8.2.7"]
SPLUNK_PLATFORM: ["x64_windows_2019","x64_windows_2022" ]
ORCA_CLOUD: ["aws"]
ORCA_OPTION: [""]
PLATFORM: ["windows"]
script: |
make orca-test-ta -e
after_script:
# spin down orca deployments
- "cd ${CI_PROJECT_DIR}"
- deployment_id=$(grep "orca_deployment_id" $TEST_FOLDER/orca_deployment.json | awk -F ':' '{print $2}' | awk -F '"' '{print $2}')
- splunk_orca --cloud ${ORCA_CLOUD} destroy "${deployment_id}"
artifacts:
when: always
paths:
- "$BUILD_DIR/out/**/*"
- "$BUILD_DIR/$CI_JOB_ID/**/*"
AppInspect_local:
hughesjj marked this conversation as resolved.
Show resolved Hide resolved
image: "${DOCKER_CICD_REPO}/ci-container/python-3.11-bullseye:1.19.0"
dependencies:
- "package-technical-addon"
stage: code-analysis
# AppInspect regex bugs out on python 3.11
image: docker.repo.splunkdev.net/ci-cd/ci-container/python-3.9:1.26.0
before_script:
- pip install splunk-add-on-ucc-framework
- pip install splunk-packaging-toolkit
- pip install splunk-appinspect
script:
- 'which "$BUILD_DIR/out/distribution/Splunk_TA_otel.tgz" && exit 1'
- splunk-appinspect inspect --mode precert --included-tags cloud --output-file "$BUILD_DIR/out/appinspect_report_local.json" "$BUILD_DIR/out/distribution/Splunk_TA_otel.tgz"
artifacts:
paths:
- "$BUILD_DIR/out/appinspect_report_local.json"
- "$BUILD_DIR/out/distribution/**/*"
expire_in: 21 day
when: always
allow_failure: false

.instrumentation-deb-rpm:
extends: .trigger-filter
stage: package
Expand Down
9 changes: 4 additions & 5 deletions packaging/technical-addon/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Used for building
SOURCE_DIR?=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
BUILD_DIR?=./build
BUILD_DIR?=$(realpath .)/build
OTEL_COLLECTOR_VERSION?=0.111.0
SPLUNK_OTELCOL_DOWNLOAD_BASE?=https://github.com/signalfx/splunk-otel-collector/releases/download
PLATFORM?=linux
Expand Down Expand Up @@ -87,8 +87,8 @@ package-ta: env-guard-ta
.PHONY: distribute-ta
distribute-ta: generate-technical-addon download-release package-ta

.PHONY: verify-ta
verify-ta: env-guard-verify
.PHONY: orca-test-ta
orca-test-ta: env-guard-verify
SOURCE_DIR="$(SOURCE_DIR)" \
BUILD_DIR="$(BUILD_DIR)" \
ARCH="$(ARCH)" \
Expand All @@ -98,7 +98,7 @@ verify-ta: env-guard-verify
UF_VERSION="$(UF_VERSION)" \
SPLUNK_PLATFORM="$(SPLUNK_PLATFORM)" \
OLLY_ACCESS_TOKEN="$(OLLY_ACCESS_TOKEN)" \
$(SOURCE_DIR)/packaging-scripts/deploy-and-verify.sh
$(SOURCE_DIR)/packaging-scripts/cicd-tests/happypath-test.sh

.PHONY: smoketest-ta
smoketest-ta:
Expand All @@ -116,7 +116,6 @@ discovery-test-ta:
PLATFORM="$(PLATFORM)" \
$(SOURCE_DIR)/packaging-scripts/cicd-tests/discovery/discovery-docker-test.sh


.PHONY: update-ta-deps
update-ta-deps:
SOURCE_DIR="$(SOURCE_DIR)" \
Expand Down
8 changes: 2 additions & 6 deletions packaging/technical-addon/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Need Help?
See `#otel-ta-community` for help.

# Developing this TA
See [`CONTRIBUTING.md`](./CONTRIBUTING.md)

# Configuration
## environment variables
In addition to the typical collector environment variables, we additionally provide
Expand Down Expand Up @@ -36,6 +30,8 @@ operating system (ex windows, linux).
This can be accomplished by removing either `Splunk_TA_Otel/linux_x86_64` or
`Splunk_TA_Otel/windows_x86_64`, respectively.

Further, they may remove the agent bundle downloaded to the `bin/` folder in these platform specific directories if they don't need smart agent support.

## Maintaining configuration between upgrades
As with all TAs, any changes made to `configs` will be overwritten.
Customers should copy any relevant custom configuration from `configs/` or `defaults/`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ extract_bundle() {
BUNDLE_PARENT="$(realpath --canonicalize-missing "$SPLUNK_BUNDLE_DIR/../")"
splunk_TA_otel_log_msg "DEBUG" "will cd to $BUNDLE_PARENT"
tar -C "$BUNDLE_PARENT" -xzf "$splunk_TA_otel_script_directory/$SMART_AGENT_BUNDLE" || splunk_TA_otel_log_error "failed to extract $splunk_TA_otel_script_directory/$SMART_AGENT_BUNDLE to $SPLUNK_BUNDLE_DIR"
splunk_TA_otel_log_msg "INFO" "agent bundle extracted to $SPLUNK_BUNDLE_DIR"
splunk_TA_otel_log_msg "INFO" "Done extracting agent bundle to $SPLUNK_BUNDLE_DIR"

# Patch everything in agent-bundle/bin to use our provided .so
root_path="$(readlink -f "$splunk_bundle_dir_value")"
Expand Down
Loading