Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
[HLS-4185] - fix linting tests (#8)
Browse files Browse the repository at this point in the history
* fix linting tests

* check only 1 k8s version

* apply ci fix from original repo

* change e2e to static version

* updare default version

* revert collector image change

* remove scripts - test

* Revert "remove scripts - test"

This reverts commit c079dc0.

* remove new groups in e2e

* update

* update python version

* update python version

* update nodejs tests

* update

* update nodejs test

* update nodejs test
  • Loading branch information
LironKS authored Aug 9, 2023
1 parent 8c171f9 commit f32c44f
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 21 deletions.
42 changes: 38 additions & 4 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,42 @@ on:
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
CURRENT_KIND_VERSION: 0.20.0
LEGACY_KIND_VERSION: 0.17.0 # for K8s versions latest kind doesn't support anymore

jobs:
e2e-tests:
name: End-to-end tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
# The e2e tests are run on the lowest and highest supported k8s version.
# All Kubernetes version in between expose the same APIs, hence the operator
# should be compatible with them.
kube-version:
- "1.19"
- "1.25"
group:
- e2e e2e-upgrade
# - e2e-prometheuscr
# - e2e-autoscale

steps:

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: "1.20"

- name: Setup kind
env:
KIND_VERSION: ${{ matrix.kube_version >= 1.21 && env.KIND_VERSION || env.LEGACY_KIND_VERSION }}
run: go install sigs.k8s.io/kind@v${KIND_VERSION}

- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand All @@ -35,10 +52,27 @@ jobs:
- name: "run tests"
env:
KUBE_VERSION: ${{ matrix.kube-version }}
run: make prepare-e2e e2e e2e-upgrade KUBE_VERSION=$KUBE_VERSION VERSION=e2e
run: make prepare-e2e ${{ matrix.group }} KUBE_VERSION=$KUBE_VERSION VERSION=0.0.4

- name: "log operator if failed"
if: ${{ failure() }}
env:
KUBE_VERSION: ${{ matrix.kube-version }}
run: make e2e-log-operator KUBE_VERSION=$KUBE_VERSION

e2e-tests-check:
runs-on: ubuntu-20.04
if: always()
needs: [e2e-tests]
steps:
- name: Print result
run: echo ${{ needs.e2e-tests.result }}
- name: Interpret result
run: |
if [[ success == ${{ needs.e2e-tests.result }} ]]
then
echo "All matrix jobs passed!"
else
echo "One or more matrix jobs failed."
false
fi
34 changes: 32 additions & 2 deletions .github/workflows/scorecard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ on:
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
CURRENT_KIND_VERSION: 0.20.0
LEGACY_KIND_VERSION: 0.17.0 # for K8s versions latest kind doesn't support anymore

jobs:
scorecard-tests:
name: test on k8s
Expand All @@ -19,9 +27,14 @@ jobs:
steps:

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: "1.20"

- name: Setup kind
env:
KIND_VERSION: ${{ matrix.kube_version >= 1.21 && env.KIND_VERSION || env.LEGACY_KIND_VERSION }}
run: go install sigs.k8s.io/kind@v${KIND_VERSION}

- name: Check out code into the Go module directory
uses: actions/checkout@v3
Expand All @@ -39,3 +52,20 @@ jobs:

- name: "run scorecard test"
run: make scorecard-tests

scorecard-tests-check:
runs-on: ubuntu-20.04
if: always()
needs: [scorecard-tests]
steps:
- name: Print result
run: echo ${{ needs.scorecard-tests.result }}
- name: Interpret result
run: |
if [[ success == ${{ needs.scorecard-tests.result }} ]]
then
echo "All matrix jobs passed!"
else
echo "One or more matrix jobs failed."
false
fi
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ linters-settings:
goheader:
template-path: header.txt
goimports:
local-prefixes: github.com/open-telemetry/opentelemetry-operator
local-prefixes: github.com/helios/opentelemetry-operator
maligned:
suggest-new: true
misspell:
Expand Down
4 changes: 2 additions & 2 deletions hack/install-kuttl.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

sudo curl -Lo /usr/local/bin/kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v0.12.1/kubectl-kuttl_0.12.1_linux_x86_64
sudo curl -Lo /usr/local/bin/kubectl-kuttl https://github.com/kudobuilder/kuttl/releases/download/v0.15.0/kubectl-kuttl_0.15.0_linux_x86_64
sudo chmod +x /usr/local/bin/kubectl-kuttl
export PATH=$PATH:/usr/local/bin
export PATH=$PATH:/usr/local/bin
2 changes: 1 addition & 1 deletion kind-1.19.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.19.16@sha256:707469aac7e6805e52c3bde2a8a8050ce2b15decff60db6c5077ba9975d28b98
image: kindest/node:v1.19.16@sha256:476cb3269232888437b61deca013832fee41f9f074f9bed79f57e4280f7c48b7
2 changes: 1 addition & 1 deletion kind-1.20.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.20.15@sha256:d67de8f84143adebe80a07672f370365ec7d23f93dc86866f0e29fa29ce026fe
image: kindest/node:v1.20.15@sha256:a32bf55309294120616886b5338f95dd98a2f7231519c7dedcec32ba29699394
2 changes: 1 addition & 1 deletion kind-1.21.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.21.14@sha256:f9b4d3d1112f24a7254d2ee296f177f628f9b4c1b32f0006567af11b91c1f301
image: kindest/node:v1.21.14@sha256:8a4e9bb3f415d2bb81629ce33ef9c76ba514c14d707f9797a01e3216376ba093
2 changes: 1 addition & 1 deletion kind-1.22.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.22.13@sha256:4904eda4d6e64b402169797805b8ec01f50133960ad6c19af45173a27eadf959
image: kindest/node:v1.22.17@sha256:f5b2e5698c6c9d6d0adc419c0deae21a425c07d81bbf3b6a6834042f25d4fba2
2 changes: 1 addition & 1 deletion kind-1.23.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.23.10@sha256:f047448af6a656fae7bc909e2fab360c18c487ef3edc93f06d78cdfd864b2d12
image: kindest/node:v1.23.17@sha256:59c989ff8a517a93127d4a536e7014d28e235fb3529d9fba91b3951d461edfdb
2 changes: 1 addition & 1 deletion kind-1.24.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.24.4@sha256:adfaebada924a26c2c9308edd53c6e33b3d4e453782c0063dc0028bdebaddf98
image: kindest/node:v1.24.15@sha256:7db4f8bea3e14b82d12e044e25e34bd53754b7f2b0e9d56df21774e6f66a70ab
2 changes: 1 addition & 1 deletion kind-1.25.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
image: kindest/node:v1.25.3@sha256:f1de3b0670462f43280114eccceab8bf1b9576d2afe0582f8f74529da6fd0365
image: kindest/node:v1.25.11@sha256:227fa11ce74ea76a0474eeefb84cb75d8dad1b08638371ecf0e86259b35be0c8
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func main() {
pflag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
pflag.StringVar(&collectorImage, "collector-image", fmt.Sprintf("gethelios/opentelemetry-collector:%s", v.OpenTelemetryCollector), "The default OpenTelemetry collector image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&collectorImage, "collector-image", fmt.Sprintf("ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector:%s", v.OpenTelemetryCollector), "The default OpenTelemetry collector image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&targetAllocatorImage, "target-allocator-image", fmt.Sprintf("gethelios/target-allocator:%s", v.TargetAllocator), "The default OpenTelemetry target allocator image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&autoInstrumentationJava, "auto-instrumentation-java-image", fmt.Sprintf("gethelios/autoinstrumentation-java:%s", v.AutoInstrumentationJava), "The default OpenTelemetry Java instrumentation image. This image is used when no image is specified in the CustomResource.")
pflag.StringVar(&autoInstrumentationNodeJS, "auto-instrumentation-nodejs-image", fmt.Sprintf("gethelios/autoinstrumentation-nodejs:%s", v.AutoInstrumentationNodeJS), "The default OpenTelemetry NodeJS instrumentation image. This image is used when no image is specified in the CustomResource.")
Expand Down
2 changes: 1 addition & 1 deletion pkg/instrumentation/podmutator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func TestMutatePod(t *testing.T) {
Value: "true",
},
{
Name: "OTEL_INSTRUMENTATION_JDBC_ENABLED",
Name: "OTEL_INSTRUMENTATION_JDBC_ENABLED",
Value: "false",
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ spec:
env:
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation/autoinstrumentation.js'
- name: HS_IMAGE_NAME
value: "ghcr.io/anuraaga/express-hello-world:latest"
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
Expand Down Expand Up @@ -40,6 +42,8 @@ spec:
env:
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation/autoinstrumentation.js'
- name: HS_IMAGE_NAME
value: "rabbitmq"
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
env:
- name: NODE_OPTIONS
value: ' --require /otel-auto-instrumentation/autoinstrumentation.js'
- name: HS_IMAGE_NAME
value: "rabbitmq"
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/instrumentation-nodejs/01-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
- name: NODE_OPTIONS
value: " --require /otel-auto-instrumentation/autoinstrumentation.js"
- name: HS_IMAGE_NAME
value: ""
value: "ghcr.io/anuraaga/express-hello-world:latest"
- name: OTEL_TRACES_EXPORTER
value: otlp
- name: OTEL_EXPORTER_OTLP_ENDPOINT
Expand Down
4 changes: 2 additions & 2 deletions versions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
opentelemetry-collector=0.68.0

# Represents the current release of the OpenTelemetry Operator.
operator=0.68.0
operator=0.0.4

# Represents the current release of the Target Allocator.
targetallocator=0.68.0
Expand All @@ -20,7 +20,7 @@ autoinstrumentation-nodejs=1.0.55

# Represents the current release of Python instrumentation.
# Should match value in autoinstrumentation/python/requirements.txt
autoinstrumentation-python=0.36b0
autoinstrumentation-python=v1.0.66

# Represents the current release of DotNet instrumentation.
# Should match autoinstrumentation/dotnet/version.txt
Expand Down

0 comments on commit f32c44f

Please sign in to comment.