From f32c44fe499e41e482ff8e53d6cf1b7d44215e78 Mon Sep 17 00:00:00 2001 From: LironKS <103920775+LironKS@users.noreply.github.com> Date: Wed, 9 Aug 2023 12:19:34 +0300 Subject: [PATCH] [HLS-4185] - fix linting tests (#8) * 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 c079dc039259f4a01ede5c365a3f9f6e8fc5e6f9. * remove new groups in e2e * update * update python version * update python version * update nodejs tests * update * update nodejs test * update nodejs test --- .github/workflows/e2e.yaml | 42 +++++++++++++++++-- .github/workflows/scorecard.yaml | 34 ++++++++++++++- .golangci.yaml | 2 +- hack/install-kuttl.sh | 4 +- kind-1.19.yaml | 2 +- kind-1.20.yaml | 2 +- kind-1.21.yaml | 2 +- kind-1.22.yaml | 2 +- kind-1.23.yaml | 2 +- kind-1.24.yaml | 2 +- kind-1.25.yaml | 2 +- main.go | 2 +- pkg/instrumentation/podmutator_test.go | 2 +- .../01-assert.yaml | 4 ++ .../02-assert.yaml | 2 + .../e2e/instrumentation-nodejs/01-assert.yaml | 2 +- versions.txt | 4 +- 17 files changed, 91 insertions(+), 21 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 7e285901cd..4bcef6d0ec 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -6,11 +6,20 @@ 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 @@ -18,13 +27,21 @@ jobs: 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 @@ -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 \ No newline at end of file diff --git a/.github/workflows/scorecard.yaml b/.github/workflows/scorecard.yaml index fa011fe7f3..0e1f491225 100644 --- a/.github/workflows/scorecard.yaml +++ b/.github/workflows/scorecard.yaml @@ -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 @@ -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 @@ -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 \ No newline at end of file diff --git a/.golangci.yaml b/.golangci.yaml index 6a5007561e..6447f246f4 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -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: diff --git a/hack/install-kuttl.sh b/hack/install-kuttl.sh index 760e786fe8..bf0c2d9ced 100755 --- a/hack/install-kuttl.sh +++ b/hack/install-kuttl.sh @@ -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 \ No newline at end of file diff --git a/kind-1.19.yaml b/kind-1.19.yaml index 8b85a6a66d..06d7e0c715 100644 --- a/kind-1.19.yaml +++ b/kind-1.19.yaml @@ -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 diff --git a/kind-1.20.yaml b/kind-1.20.yaml index 44e7f6ae9c..04e097cf58 100644 --- a/kind-1.20.yaml +++ b/kind-1.20.yaml @@ -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 diff --git a/kind-1.21.yaml b/kind-1.21.yaml index 2894a87c46..2aff9ffb30 100644 --- a/kind-1.21.yaml +++ b/kind-1.21.yaml @@ -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 diff --git a/kind-1.22.yaml b/kind-1.22.yaml index 27fe599db8..d5a0bb8796 100644 --- a/kind-1.22.yaml +++ b/kind-1.22.yaml @@ -2,4 +2,4 @@ kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 nodes: - role: control-plane - image: kindest/node:v1.22.13@sha256:4904eda4d6e64b402169797805b8ec01f50133960ad6c19af45173a27eadf959 \ No newline at end of file + image: kindest/node:v1.22.17@sha256:f5b2e5698c6c9d6d0adc419c0deae21a425c07d81bbf3b6a6834042f25d4fba2 \ No newline at end of file diff --git a/kind-1.23.yaml b/kind-1.23.yaml index 5728285a18..3160afc919 100644 --- a/kind-1.23.yaml +++ b/kind-1.23.yaml @@ -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 diff --git a/kind-1.24.yaml b/kind-1.24.yaml index 56553b608f..ece3f7cf71 100644 --- a/kind-1.24.yaml +++ b/kind-1.24.yaml @@ -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 diff --git a/kind-1.25.yaml b/kind-1.25.yaml index fd8831adb8..a0116eb236 100644 --- a/kind-1.25.yaml +++ b/kind-1.25.yaml @@ -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 diff --git a/main.go b/main.go index 1d85448b0c..481cbdd551 100644 --- a/main.go +++ b/main.go @@ -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.") diff --git a/pkg/instrumentation/podmutator_test.go b/pkg/instrumentation/podmutator_test.go index fca9f37b01..f813a07f22 100644 --- a/pkg/instrumentation/podmutator_test.go +++ b/pkg/instrumentation/podmutator_test.go @@ -148,7 +148,7 @@ func TestMutatePod(t *testing.T) { Value: "true", }, { - Name: "OTEL_INSTRUMENTATION_JDBC_ENABLED", + Name: "OTEL_INSTRUMENTATION_JDBC_ENABLED", Value: "false", }, { diff --git a/tests/e2e/instrumentation-nodejs-multicontainer/01-assert.yaml b/tests/e2e/instrumentation-nodejs-multicontainer/01-assert.yaml index 17f8bd73ac..8f27e609d6 100644 --- a/tests/e2e/instrumentation-nodejs-multicontainer/01-assert.yaml +++ b/tests/e2e/instrumentation-nodejs-multicontainer/01-assert.yaml @@ -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 @@ -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 diff --git a/tests/e2e/instrumentation-nodejs-multicontainer/02-assert.yaml b/tests/e2e/instrumentation-nodejs-multicontainer/02-assert.yaml index d9688c06ec..112e4a3836 100644 --- a/tests/e2e/instrumentation-nodejs-multicontainer/02-assert.yaml +++ b/tests/e2e/instrumentation-nodejs-multicontainer/02-assert.yaml @@ -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 diff --git a/tests/e2e/instrumentation-nodejs/01-assert.yaml b/tests/e2e/instrumentation-nodejs/01-assert.yaml index 298d5c9734..42454b1c56 100644 --- a/tests/e2e/instrumentation-nodejs/01-assert.yaml +++ b/tests/e2e/instrumentation-nodejs/01-assert.yaml @@ -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 diff --git a/versions.txt b/versions.txt index 63f05e7716..e5ca1778a5 100644 --- a/versions.txt +++ b/versions.txt @@ -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 @@ -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