From b99b0d9ee7c627f8d74b38a7a8848d25042538b9 Mon Sep 17 00:00:00 2001 From: Liora Milbaum Date: Sat, 16 Mar 2024 15:52:12 +0200 Subject: [PATCH] devcontainer for dev environment setup --- .devcontainer/devcontainer.json | 9 +++++++++ .github/workflows/devcontainer.yml | 20 ++++++++++++++++++++ .pre-commit-config.yaml | 4 ++++ DEVELOPMENT.md | 4 ++++ README.md | 1 + 5 files changed, 38 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/devcontainer.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..753559a94b0 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,9 @@ +{ + "name": "Tekton pipeline", + "image": "mcr.microsoft.com/vscode/devcontainers/go:1.22", + "features": { + "ghcr.io/devcontainers-contrib/features/pre-commit:2.0.17": { + "version": "3.6.2" + } + } +} diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml new file mode 100644 index 00000000000..79b8895cb66 --- /dev/null +++ b/.github/workflows/devcontainer.yml @@ -0,0 +1,20 @@ +--- +name: 'devcontainer' + +on: + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: Checkout (GitHub) + uses: actions/checkout@v4.1.1 + + - name: Build and run dev container task + uses: devcontainers/ci@v0.3.1900000348 + with: + runCmd: pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6115dda0901..42e6e55e70b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,3 +32,7 @@ repos: language: system types: [go] pass_filenames: false +- repo: https://github.com/python-jsonschema/check-jsonschema + rev: 0.28.0 + hooks: + - id: check-github-actions diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index f3992d3e21f..283dc608d25 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -356,6 +356,10 @@ optional: As a convenience, the [Tekton plumbing project](https://github.com/tek --user=$(gcloud config get-value core/account) ``` +#### Using [devcontainer](https://code.visualstudio.com/docs/devcontainers/containers) + +- Follow the instruction for [getting up and running](https://code.visualstudio.com/docs/devcontainers/tutorial) + --- ## Developing and testing diff --git a/README.md b/README.md index 31275be08e7..754e5655846 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit) [![Go Report Card](https://goreportcard.com/badge/tektoncd/pipeline)](https://goreportcard.com/report/tektoncd/pipeline) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/4020/badge)](https://bestpractices.coreinfrastructure.org/projects/4020) +[![devcontainer](https://img.shields.io/static/v1?label=devcontainer&message=enabled&logo=visualstudiocode&color=007ACC&logoColor=007ACC)](https://code.visualstudio.com/docs/devcontainers/containers) The Tekton Pipelines project provides k8s-style resources for declaring CI/CD-style pipelines.