From 56b3dd539265aae25119bbd8286ab584811cbe08 Mon Sep 17 00:00:00 2001 From: Alex Tugarev Date: Wed, 29 Nov 2023 10:51:06 +0100 Subject: [PATCH] Install pre-commit hooks in prebuild (#19159) * [dev/image] Install pre-commit hooks under /workspace during prebuilds * Separate task: Install pre-commit hooks * Update dev image with `env PRE_COMMIT_HOME` --- .github/actions/delete-preview/Dockerfile | 2 +- .github/actions/deploy-gitpod/Dockerfile | 2 +- .github/actions/deploy-monitoring-satellite/Dockerfile | 2 +- .github/actions/preview-create/Dockerfile | 2 +- .github/workflows/build.yml | 6 +++--- .github/workflows/code-nightly.yml | 2 +- .github/workflows/ide-integration-tests.yml | 4 ++-- .github/workflows/lacework-inline-scanner.yml | 2 +- .github/workflows/preview-env-check-regressions.yml | 2 +- .github/workflows/preview-env-gc.yml | 2 +- .github/workflows/workspace-integration-tests.yml | 6 +++--- .gitpod.yml | 7 +++++-- dev/image/Dockerfile | 3 +++ 13 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.github/actions/delete-preview/Dockerfile b/.github/actions/delete-preview/Dockerfile index 43c79747fe97d3..667a525bb8d312 100644 --- a/.github/actions/delete-preview/Dockerfile +++ b/.github/actions/delete-preview/Dockerfile @@ -1,4 +1,4 @@ -FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 +FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/deploy-gitpod/Dockerfile b/.github/actions/deploy-gitpod/Dockerfile index 43c79747fe97d3..667a525bb8d312 100644 --- a/.github/actions/deploy-gitpod/Dockerfile +++ b/.github/actions/deploy-gitpod/Dockerfile @@ -1,4 +1,4 @@ -FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 +FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/deploy-monitoring-satellite/Dockerfile b/.github/actions/deploy-monitoring-satellite/Dockerfile index 43c79747fe97d3..667a525bb8d312 100644 --- a/.github/actions/deploy-monitoring-satellite/Dockerfile +++ b/.github/actions/deploy-monitoring-satellite/Dockerfile @@ -1,4 +1,4 @@ -FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 +FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/preview-create/Dockerfile b/.github/actions/preview-create/Dockerfile index 43c79747fe97d3..667a525bb8d312 100644 --- a/.github/actions/preview-create/Dockerfile +++ b/.github/actions/preview-create/Dockerfile @@ -1,4 +1,4 @@ -FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 +FROM eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 COPY entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 638d6fbeac73e6..300018c8daeb2e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -98,7 +98,7 @@ jobs: cancel-in-progress: ${{ needs.configuration.outputs.is_main_branch == 'false' }} runs-on: ${{ needs.create-runner.outputs.label }} container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 outputs: previewctl_hash: ${{ steps.build.outputs.previewctl_hash }} steps: @@ -161,7 +161,7 @@ jobs: ports: - 6379:6379 container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 env: DB_HOST: "mysql" DB_PORT: "23306" @@ -401,7 +401,7 @@ jobs: - create-runner runs-on: ${{ needs.create-runner.outputs.label }} container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 if: needs.configuration.outputs.with_integration_tests != '' concurrency: group: ${{ needs.configuration.outputs.preview_name }}-integration-test diff --git a/.github/workflows/code-nightly.yml b/.github/workflows/code-nightly.yml index 04a51fc3dc3d8e..2275503cad3cd4 100644 --- a/.github/workflows/code-nightly.yml +++ b/.github/workflows/code-nightly.yml @@ -16,7 +16,7 @@ jobs: runs-on: ${{ needs.create-runner.outputs.label }} needs: [create-runner] container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup-environment diff --git a/.github/workflows/ide-integration-tests.yml b/.github/workflows/ide-integration-tests.yml index 987daa180d4437..795b109af34a75 100644 --- a/.github/workflows/ide-integration-tests.yml +++ b/.github/workflows/ide-integration-tests.yml @@ -31,7 +31,7 @@ jobs: runs-on: ${{ needs.create-runner.outputs.label }} needs: [create-runner] container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 outputs: name: ${{ steps.configuration.outputs.name }} version: ${{ steps.configuration.outputs.version }} @@ -101,7 +101,7 @@ jobs: needs: [configuration, infrastructure, create-runner] runs-on: ${{ needs.create-runner.outputs.label }} container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 volumes: - /var/tmp:/var/tmp - /tmp:/tmp diff --git a/.github/workflows/lacework-inline-scanner.yml b/.github/workflows/lacework-inline-scanner.yml index d3450f2671c213..5aee47e057d30c 100644 --- a/.github/workflows/lacework-inline-scanner.yml +++ b/.github/workflows/lacework-inline-scanner.yml @@ -51,7 +51,7 @@ jobs: needs: [configuration,create-runner] if: ${{ needs.configuration.outputs.skip == 'false' }} container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 steps: # Most of this is taken over from the Build workflow/preview-env-check-regressions workflow - uses: actions/checkout@v4 diff --git a/.github/workflows/preview-env-check-regressions.yml b/.github/workflows/preview-env-check-regressions.yml index 12086fc3f96a1e..763c05d85e4129 100644 --- a/.github/workflows/preview-env-check-regressions.yml +++ b/.github/workflows/preview-env-check-regressions.yml @@ -86,7 +86,7 @@ jobs: if: ${{ needs.configuration.outputs.skip == 'false' }} runs-on: ${{ needs.create-runner.outputs.label }} container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 volumes: - /var/tmp:/var/tmp - /tmp:/tmp diff --git a/.github/workflows/preview-env-gc.yml b/.github/workflows/preview-env-gc.yml index d6ccb1b955d5a5..046540597ae487 100644 --- a/.github/workflows/preview-env-gc.yml +++ b/.github/workflows/preview-env-gc.yml @@ -15,7 +15,7 @@ jobs: runs-on: ${{ needs.create-runner.outputs.label }} needs: [create-runner] container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 outputs: names: ${{ steps.set-matrix.outputs.names }} count: ${{ steps.set-matrix.outputs.count }} diff --git a/.github/workflows/workspace-integration-tests.yml b/.github/workflows/workspace-integration-tests.yml index 379829dbcad181..b0fa8efcb45530 100644 --- a/.github/workflows/workspace-integration-tests.yml +++ b/.github/workflows/workspace-integration-tests.yml @@ -45,7 +45,7 @@ jobs: runs-on: ${{ needs.create-runner.outputs.label }} needs: [create-runner] container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 outputs: name: ${{ steps.configuration.outputs.name }} version: ${{ steps.configuration.outputs.version }} @@ -136,7 +136,7 @@ jobs: needs: [configuration, infrastructure, create-runner] runs-on: ${{ needs.create-runner.outputs.label }} container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 steps: - uses: actions/checkout@v4 - id: auth @@ -167,7 +167,7 @@ jobs: if: inputs.skip_delete != 'true' && always() runs-on: ${{ needs.create-runner.outputs.label }} container: - image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 + image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 steps: - uses: actions/checkout@v4 - name: Delete preview environment diff --git a/.gitpod.yml b/.gitpod.yml index d55e5aa15c8d43..19f35b24173c96 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:se-update-leeway-gha.20594 +image: eu.gcr.io/gitpod-core-dev/dev/dev-environment:at-user-getauthenticated-dashboard-gha.20954 workspaceLocation: gitpod/gitpod-ws.code-workspace checkoutLocation: gitpod ports: @@ -65,8 +65,11 @@ tasks: leeway exec --package components/ide/jetbrains/backend-plugin:plugin-latest --package components/ide/jetbrains/gateway-plugin:publish-latest --parallel -- ./gradlew buildPlugin - name: TypeScript init: yarn --network-timeout 100000 && yarn build + - name: Install pre-commit hooks + init: | + pre-commit install --install-hooks + exit 0 - name: Go - before: pre-commit install --install-hooks init: | ./components/gitpod-protocol/go/scripts/generate-config.sh leeway exec --filter-type go -v -- go mod verify diff --git a/dev/image/Dockerfile b/dev/image/Dockerfile index 797a534a0b59a3..20d0d2ff862e1e 100644 --- a/dev/image/Dockerfile +++ b/dev/image/Dockerfile @@ -267,3 +267,6 @@ RUN curl -fsSL https://github.com/csweichel/oci-tool/releases/download/v0.2.0/oc RUN go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@latest RUN sudo install-packages pigz + +# Install pre-commit hooks under /workspace during prebuilds +ENV PRE_COMMIT_HOME=/workspace/.pre-commit