diff --git a/.github/env b/.github/env new file mode 100644 index 00000000..a5789fdf --- /dev/null +++ b/.github/env @@ -0,0 +1,2 @@ +golang-version=1.17 +golangci-lint-version=v1.42.1 \ No newline at end of file diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml new file mode 100644 index 00000000..2a95c7b9 --- /dev/null +++ b/.github/workflows/cli.yml @@ -0,0 +1,140 @@ +name: CLI Tests + +on: + push: + branches: [master, main, force_test, release-*] + tags: ['*'] + pull_request: + branches: ['**'] + +jobs: + build: + name: Build and Lint + runs-on: ubuntu-latest + steps: + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Import environment variables + run: cat ".github/env" >> $GITHUB_ENV + + - name: Set up Go ${{ env.golang-version }} + uses: actions/setup-go@v2.1.5 + with: + go-version: ${{ env.golang-version }} + id: go + + - name: Format + working-directory: cli + run: | + make go-fmt + + - name: Vet + working-directory: cli + run: | + make go-vet + + # TODO(paulfantom): figure-out why golangci-lint action crashes + #- name: Lint + # uses: golangci/golangci-lint-action@v2 + # with: + # version: ${{ env.golangci-lint-version }} + + - name: Build + working-directory: cli + run: | + make build + + tests: + name: Tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Import environment variables + run: cat ".github/env" >> $GITHUB_ENV + + - name: Set up Go ${{ env.golang-version }} + uses: actions/setup-go@v2.1.5 + with: + go-version: ${{ env.golang-version }} + + # TODO(paulfantom): Figure out better way to test it and ignore entries which are randomly generated and thus not reproducible in CI + #- name: Test static generation + # working-directory: ../ + # run: | + # ./generate-deploy-script.sh + # git diff --exit-code + + - name: Unit-Tests + working-directory: cli + run: | + make unit-tests + + - name: Dependency-Tests + working-directory: cli + run: | + go test -v ./tests/dependency-tests + + e2e: + name: E2E tests + runs-on: ubuntu-latest + strategy: + matrix: + kube-version: + - "1.21" + - "1.22" + - "1.23" + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Import environment variables + run: cat ".github/env" >> $GITHUB_ENV + + - name: Set up Go ${{ env.golang-version }} + uses: actions/setup-go@v2.1.5 + with: + go-version: ${{ env.golang-version }} + + - name: Build + working-directory: cli + run: | + make build + + - name: Start kuberenetes cluster + working-directory: cli + env: + KUBE_VERSION: ${{ matrix.kube-version }} + run: | + make start-kind + + - name: Helm tests + working-directory: cli + env: + KUBE_VERSION: ${{ matrix.kube-version }} + run: | + make helm-tests + + - name: E2E tests + working-directory: cli + env: + KUBE_VERSION: ${{ matrix.kube-version }} + run: | + make e2e-tests + + # Added to summarize the matrix + tests-result: + name: e2e results + if: always() + needs: + - e2e + runs-on: ubuntu-latest + steps: + - name: Mark the job as a success + if: needs.e2e.result == 'success' + run: exit 0 + - name: Mark the job as a failure + if: needs.e2e.result != 'success' + run: exit 1 diff --git a/.github/workflows/e2e-tests.yaml b/.github/workflows/e2e-tests.yaml deleted file mode 100644 index f4d5cddc..00000000 --- a/.github/workflows/e2e-tests.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: E2E Tests - -on: - push: - branches: [master] - pull_request: - branches: [master] - -jobs: - build: - name: Build - runs-on: ubuntu-latest - strategy: - matrix: - kube-version: - - "1.21" - - "1.22" - - "1.23" - - env: - working-directory: ./cli - steps: - - name: Setup Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Check out master - uses: actions/checkout@v2 - - - name: Build - working-directory: ${{env.working-directory}} - run: | - make build - - - name: HELM-E2E-Tests - working-directory: ${{env.working-directory}} - env: - KUBE_VERSION: ${{ matrix.kube-version }} - run: | - make start-kind helm-tests e2e-tests delete-kind KUBE_VERSION=$KUBE_VERSION \ No newline at end of file diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml deleted file mode 100644 index 945b24ed..00000000 --- a/.github/workflows/generate.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Go Tests - -on: - push: - branches: [master] - pull_request: - branches: [master] - -jobs: - build: - name: Build - runs-on: ubuntu-latest - env: - working-directory: ./cli - steps: - - name: Setup Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Check out master - uses: actions/checkout@v2 - - - name: Test static generation - run: | - ./generate-deploy-script.sh - # git diff --exit-code - - - name: Format - working-directory: ${{env.working-directory}} - run: | - make go-fmt - - - name: Vet - working-directory: ${{env.working-directory}} - run: | - make go-vet - - - name: Lint - working-directory: ${{env.working-directory}} - run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0 - golangci-lint run - - - name: Build - working-directory: ${{env.working-directory}} - run: | - make build - - - name: Unit-Tests - working-directory: ${{env.working-directory}} - run: | - make unit-tests - - - name: Dependency-Tests - working-directory: ${{env.working-directory}} - run: | - go test -v ./tests/dependency-tests \ No newline at end of file diff --git a/.github/workflows/go-releaser.yml b/.github/workflows/go-releaser.yml index 18660986..c65e48b0 100644 --- a/.github/workflows/go-releaser.yml +++ b/.github/workflows/go-releaser.yml @@ -11,18 +11,18 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v2 + + - name: Import environment variables + run: cat ".github/env" >> $GITHUB_ENV + + - name: Set up Go ${{ env.golang-version }} + uses: actions/setup-go@v2.1.5 with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Run GoReleaser Test + go-version: ${{ env.golang-version }} + + - name: GoReleaser Test uses: goreleaser/goreleaser-action@v2 if: "!startsWith(github.ref, 'refs/tags/')" with: @@ -30,8 +30,8 @@ jobs: version: latest workdir: cli args: release --snapshot --skip-publish --rm-dist - - - name: GoReleaser Release + + - name: GoReleaser Release uses: goreleaser/goreleaser-action@v2 #release only on tags if: startsWith(github.ref, 'refs/tags/') diff --git a/.github/workflows/go-report-card.yml b/.github/workflows/go-report-card.yml index 95c42c08..4aff54a2 100644 --- a/.github/workflows/go-report-card.yml +++ b/.github/workflows/go-report-card.yml @@ -5,8 +5,8 @@ on: branches: [master] jobs: - build: - name: Build + report: + name: Report runs-on: ubuntu-latest steps: - name: Request Report Update diff --git a/.github/workflows/go-schedule.yml b/.github/workflows/go-schedule.yml deleted file mode 100644 index f2e2f2ca..00000000 --- a/.github/workflows/go-schedule.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Daily scheduled extended Go tests - -on: - push: - branches: [force_test, release-*] - schedule: - - cron: "6 0 * * *" - -jobs: - build: - name: Build - runs-on: ubuntu-latest - env: - working-directory: ./cli - steps: - - name: Setup Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Check out master - uses: actions/checkout@v2 - - - name: Test static generation - run: | - ./generate-deploy-script.sh - # git diff --exit-code - - - name: Format - working-directory: ${{env.working-directory}} - run: | - make go-fmt - - - name: Vet - working-directory: ${{env.working-directory}} - run: | - make go-vet - - - name: Lint - working-directory: ${{env.working-directory}} - run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0 - golangci-lint run - - - name: Build - working-directory: ${{env.working-directory}} - run: | - make build - - - name: Unit-Tests - working-directory: ${{env.working-directory}} - run: | - make unit-tests - - - name: Dependency-Tests - working-directory: ${{env.working-directory}} - run: | - go test -v ./tests/dependency-tests \ No newline at end of file diff --git a/.github/workflows/tests-schedule.yml b/.github/workflows/tests-schedule.yml index 9c84ffa9..f8420f0a 100644 --- a/.github/workflows/tests-schedule.yml +++ b/.github/workflows/tests-schedule.yml @@ -1,4 +1,4 @@ -name: Daily scheduled extended E2E tests +name: Daily scheduled Tests on: push: @@ -6,9 +6,36 @@ on: schedule: - cron: "6 0 * * *" +defaults: + run: + working-directory: cli + jobs: - build: - name: Build + golang: + name: golang + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Import environment variables + run: cat "../.github/env" >> $GITHUB_ENV + + - name: Set up Go ${{ env.golang-version }} + uses: actions/setup-go@v2.1.5 + with: + go-version: ${{ env.golang-version }} + + - name: Unit-Tests + run: | + make unit-tests + + - name: Dependency-Tests + run: | + go test -v ./tests/dependency-tests + + all-tests: + name: All runs-on: ubuntu-latest strategy: matrix: @@ -17,17 +44,18 @@ jobs: - "1.22" - "1.23" - env: - working-directory: ./cli steps: - - name: Setup Go - uses: actions/setup-go@v2 - with: - go-version: 1.17 - - - name: Check out master + - name: Checkout uses: actions/checkout@v2 + - name: Import environment variables + run: cat "../.github/env" >> $GITHUB_ENV + + - name: Set up Go ${{ env.golang-version }} + uses: actions/setup-go@v2.1.5 + with: + go-version: ${{ env.golang-version }} + - name: Build working-directory: ${{env.working-directory}} run: | diff --git a/.gitignore b/.gitignore index d55188b0..f6b87d10 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .vscode/ .idea/ cli/bin +chart/Chart.lock diff --git a/cli/tests/helm-tests/helm_test.go b/cli/tests/helm-tests/helm_test.go index af27f374..6a7e6838 100644 --- a/cli/tests/helm-tests/helm_test.go +++ b/cli/tests/helm-tests/helm_test.go @@ -81,9 +81,9 @@ func testHelmClientAddOrUpdateChartRepoPublic() { func testHelmClientInstallOrUpgradeChart() { log.Println("Installing Tobs secrets...") runTsdb := exec.Command(PATH_TO_TOBS, "install", "--namespace", NAMESPACE, "--only-secrets") - _, err := runTsdb.CombinedOutput() + msg, err := runTsdb.CombinedOutput() if err != nil { - log.Fatalf("Error installing tobs secrets %v:", err) + log.Fatalf("Error installing tobs secrets %v: %v", err, msg) } // download the dependent charts diff --git a/deploy/static/deploy.yaml b/deploy/static/deploy.yaml index b7937a88..fffa883b 100644 --- a/deploy/static/deploy.yaml +++ b/deploy/static/deploy.yaml @@ -170,7 +170,7 @@ metadata: type: Opaque data: admin-user: "YWRtaW4=" - admin-password: "SmU5S3hFZE51bVhveVpsOFdtMTJybGZTUW1VeDFzM2QzaW9qT3NpSw==" + admin-password: "b2dqNXV2dnEza3BIZ09GUUFndGczZ2w2QVY4M0xjNWFheHB4N2MwVg==" ldap-toml: "" --- # Source: tobs/charts/kube-prometheus-stack/templates/alertmanager/secret.yaml @@ -43449,6 +43449,10 @@ spec: port: 9201 targetPort: metrics-port protocol: TCP + - name: otel-port + port: 9202 + targetPort: otel-port + protocol: TCP --- # Source: tobs/charts/timescaledb-single/templates/svc-timescaledb-config.yaml # This file and its contents are licensed under the Apache License 2.0. @@ -43681,7 +43685,7 @@ spec: checksum/config: 6c66fbde35cd56d3df214ee81abcb178d25e011db6d5ea9f158a1644f2fba927 checksum/dashboards-json-config: 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b checksum/sc-dashboard-provider-config: c09419b07debdae174cba4367188547aff84fe70823128e3ac33878f5591a65f - checksum/secret: 926d2f99598bd95c819402ad6f77856cb40be15f33ac3654ae3828598fc2e28d + checksum/secret: 90ae456eccd76909b94dd4ccbc1778b1d32d4303ba6b3427487698df571b7167 spec: serviceAccountName: tobs-grafana @@ -43997,6 +44001,18 @@ spec: - image: timescale/promscale:0.8.0 imagePullPolicy: IfNotPresent name: promscale-connector + args: + - --enable-feature=tracing + - --otlp-grpc-server-listen-address=:9202 + env: + - name: TOBS_TELEMETRY_INSTALLED_BY + value: helm + - name: TOBS_TELEMETRY_VERSION + value: '{{ .Chart.Version }}' + - name: TOBS_TELEMETRY_TRACING_ENABLED + value: "false" + - name: TOBS_TELEMETRY_TIMESCALEDB_ENABLED + value: "true" envFrom: - secretRef: name: tobs-promscale @@ -44007,6 +44023,8 @@ spec: ports: - containerPort: 9201 name: metrics-port + - containerPort: 9202 + name: otel-port serviceAccountName: tobs-promscale --- # Source: tobs/templates/promlens-depoloyment.yaml @@ -44452,8 +44470,13 @@ spec: value: "5432" - name: PGUSER value: postgres + - name: PGPASSWORD - value: + valueFrom: + secretKeyRef: + name: tobs-promscale + key: PROMSCALE_DB_PASSWORD + - name: PGHOST value: tobs.tobs.svc.cluster.local command: [ 'psql', '-d', postgres, '-f', '/add-users.sql' ] @@ -48536,7 +48559,7 @@ spec: apiVersion: batch/v1 kind: Job metadata: - name: "tobs-patroni-it" + name: "tobs-patroni-1g" labels: app: tobs-timescaledb chart: timescaledb-single-0.8.2