From 4da012e0c2031e125859ced5a879d77b0a798de6 Mon Sep 17 00:00:00 2001 From: Bastian Krol Date: Tue, 20 Aug 2024 13:55:43 +0200 Subject: [PATCH 1/2] ci: remove changed files check We would actually need to compare to the commit of the last _successful_ build, not just to the last commit. Otherwise it will skip builds although the latest code has not been built yet. --- .github/workflows/ci.yaml | 61 --------------------------------------- 1 file changed, 61 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2581fca5..3492c2c1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -78,65 +78,8 @@ jobs: with: fetch-depth: 0 - # Note: By default, changed-files will compare against the last non-merge commit on the target branch for pull - # request events, and the previous remote commit of the current branch for push events. - - name: compile list of relevant changed files for instrumentation and operator controller image build - id: changed-files - uses: tj-actions/changed-files@v44 - with: - files_yaml: | - instrumentation: - - .github/actions/build-image/** - - .github/workflows/ci.yaml - - images/instrumentation/** - operator_controller: - - .github/actions/build-image/** - - .github/workflows/ci.yaml - - go.mod - - go.sum - - api/** - - cmd/** - - internal/** - collector: - - .github/actions/build-image/** - - .github/workflows/ci.yaml - - images/collector/** - configuration_reloader: - - .github/actions/build-image/** - - .github/workflows/ci.yaml - - images/configreloader/** - filelog_offset_synch: - - .github/actions/build-image/** - - .github/workflows/ci.yaml - - images/filelogoffsetsynch/** - - - name: show changed files - env: - INSTRUMENTATION_CHANGED_FILES_FLAG: ${{ steps.changed-files.outputs.instrumentation_any_changed }} - INSTRUMENTATION_CHANGED_FILES_LIST: ${{ steps.changed-files.outputs.instrumentation_all_changed_files }} - OPERATOR_CONTROLLER_CHANGED_FILES_FLAG: ${{ steps.changed-files.outputs.operator_controller_any_changed }} - OPERATOR_CONTROLLER_CHANGED_FILES_LIST: ${{ steps.changed-files.outputs.operator_controller_all_changed_files }} - COLLECTOR_CHANGED_FILES_FLAG: ${{ steps.changed-files.outputs.collector_any_changed }} - COLLECTOR_CHANGED_FILES_LIST: ${{ steps.changed-files.outputs.collector_all_changed_files }} - CONFIGURATION_RELOADER_CHANGED_FILES_FLAG: ${{ steps.changed-files.outputs.configuration_reloader_any_changed }} - CONFIGURATION_RELOADER_CHANGED_FILES_LIST: ${{ steps.changed-files.outputs.configuration_reloader_all_changed_files }} - FILELOG_OFFSET_SYNCH_CHANGED_FILES_FLAG: ${{ steps.changed-files.outputs.filelog_offset_synch_any_changed }} - FILELOG_OFFSET_SYNCH_CHANGED_FILES_LIST: ${{ steps.changed-files.outputs.filelog_offset_synch_any_changed_files }} - run: | - echo "files for instrumentation image have changed: $INSTRUMENTATION_CHANGED_FILES_FLAG" - echo "changed files for instrumentation image: $INSTRUMENTATION_CHANGED_FILES_LIST" - echo "files for operator controller image have changed: $OPERATOR_CONTROLLER_CHANGED_FILES_FLAG" - echo "changed files for operator controller image: $OPERATOR_CONTROLLER_CHANGED_FILES_LIST" - echo "files for collector image have changed: $COLLECTOR_CHANGED_FILES_FLAG" - echo "changed files for collector image: $COLLECTOR_CHANGED_FILES_LIST" - echo "files for configuration reloader image have changed: $CONFIGURATION_RELOADER_CHANGED_FILES_FLAG" - echo "changed files for configuration reloader image: $CONFIGURATION_RELOADER_CHANGED_FILES_LIST" - echo "files for file offset synch image have changed: $FILELOG_OFFSET_SYNCH_CHANGED_FILES_FLAG" - echo "changed files for file offset synch image: $FILELOG_OFFSET_SYNCH_CHANGED_FILES_LIST" - - name: build instrumentation image uses: ./.github/actions/build-image - if: steps.changed-files.outputs.instrumentation_any_changed == 'true' || contains(github.ref, 'refs/tags/') with: githubToken: ${{ secrets.GITHUB_TOKEN }} imageName: instrumentation @@ -147,7 +90,6 @@ jobs: - name: build collector image uses: ./.github/actions/build-image - if: steps.changed-files.outputs.collector_any_changed == 'true' || contains(github.ref, 'refs/tags/') with: githubToken: ${{ secrets.GITHUB_TOKEN }} imageName: collector @@ -158,7 +100,6 @@ jobs: - name: build configuration reloader image uses: ./.github/actions/build-image - if: steps.changed-files.outputs.configuration_reloader_any_changed == 'true' || contains(github.ref, 'refs/tags/') with: githubToken: ${{ secrets.GITHUB_TOKEN }} imageName: configuration-reloader @@ -169,7 +110,6 @@ jobs: - name: build operator controller image uses: ./.github/actions/build-image - if: steps.changed-files.outputs.operator_controller_any_changed == 'true' || contains(github.ref, 'refs/tags/') with: githubToken: ${{ secrets.GITHUB_TOKEN }} imageName: operator-controller @@ -180,7 +120,6 @@ jobs: - name: build filelog offset synch image uses: ./.github/actions/build-image - if: steps.changed-files.outputs.filelog_offset_synch_any_changed == 'true' || contains(github.ref, 'refs/tags/') with: githubToken: ${{ secrets.GITHUB_TOKEN }} imageName: filelog-offset-synch From 56a21b1ed1bedd381ece86ecff5ecd9f3387af76 Mon Sep 17 00:00:00 2001 From: Bastian Krol Date: Tue, 20 Aug 2024 14:07:27 +0200 Subject: [PATCH 2/2] test(e2e): delete cronjob/job test IDs at every pod churn Apparently issue with the flaky tests (cronjob spans not found) was due to the test reading the wrong test ID from the file system, very probably because an outdated test ID was still present in the file system and the new cronjob pod had not yet written its test ID. After that the test would look for spans with the wrong query parameter. --- test/e2e/e2e_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 66b03654..8d990baf 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -131,6 +131,8 @@ var _ = Describe("Dash0 Kubernetes Operator", Ordered, func() { }) By("all workloads have been deployed") + deleteTestIdFiles() + deployOperator(operatorNamespace, operatorHelmChart, operatorHelmChartUrl, images, true) deployDash0MonitoringResource( applicationUnderTestNamespace, @@ -153,6 +155,8 @@ var _ = Describe("Dash0 Kubernetes Operator", Ordered, func() { }) By("all workloads have been instrumented") + deleteTestIdFiles() + undeployDash0MonitoringResource(applicationUnderTestNamespace) runInParallelForAllWorkloadTypes(workloadConfigs, func(config controllerTestWorkloadConfig) { @@ -176,6 +180,7 @@ var _ = Describe("Dash0 Kubernetes Operator", Ordered, func() { By("installing the Node.js job") Expect(installNodeJsJob(applicationUnderTestNamespace)).To(Succeed()) deployOperator(operatorNamespace, operatorHelmChart, operatorHelmChartUrl, images, true) + deleteTestIdFiles() deployDash0MonitoringResource( applicationUnderTestNamespace, defaultDash0MonitoringValues, @@ -251,6 +256,7 @@ var _ = Describe("Dash0 Kubernetes Operator", Ordered, func() { }, } deployOperator(operatorNamespace, operatorHelmChart, operatorHelmChartUrl, initialImages, false) + deleteTestIdFiles() deployDash0MonitoringResource( applicationUnderTestNamespace, defaultDash0MonitoringValues, @@ -268,6 +274,7 @@ var _ = Describe("Dash0 Kubernetes Operator", Ordered, func() { "controller", ) + deleteTestIdFiles() upgradeOperator( operatorNamespace, operatorHelmChart, @@ -345,6 +352,7 @@ var _ = Describe("Dash0 Kubernetes Operator", Ordered, func() { // uninstrumentation procedure there. Thus, for jobs, we test the failing uninstrumentation and // its effects here. By("verifying that removing the Dash0 monitoring resource attempts to uninstruments the job") + deleteTestIdFiles() undeployDash0MonitoringResource(applicationUnderTestNamespace) Eventually(func(g Gomega) {