Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
61 changes: 60 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
workflows: ${{ steps.merge_group_defaults.outputs.workflows || steps.filter.outputs.workflows }}
publish: ${{ steps.merge_group_defaults.outputs.publish || steps.filter.outputs.publish }}
terraform: ${{ steps.merge_group_defaults.outputs.terraform || steps.filter.outputs.terraform }}
installer: ${{ steps.merge_group_defaults.outputs.installer || steps.filter.outputs.installer }}
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
Expand All @@ -40,6 +41,7 @@ jobs:
echo "workflows=true"
echo "publish=false"
echo "terraform=true"
echo "installer=true"
} >> "$GITHUB_OUTPUT"

- name: Detect changed paths
Expand Down Expand Up @@ -73,6 +75,20 @@ jobs:
terraform:
- 'terraform/**'
- '.github/workflows/ci.yaml'
installer:
- 'api/**/*.go'
- 'config/crd/bases/**'
- 'config/rbac/**'
- 'config/default/**'
- 'config/quickstart/**'
- 'deploy/deployment.yaml'
- 'deploy/apiserver-service.yaml'
- 'deploy/apiserver-apiservice.yaml'
- 'hack/update-manifests.sh'
- 'Makefile'
- 'dist/install.yaml'
- 'dist/minimal-installer.yaml'
- 'dist/quickstart-installer.yaml'

lint:
needs: changes
Expand Down Expand Up @@ -113,6 +129,48 @@ jobs:
- name: Run govulncheck
run: go tool govulncheck ./...

installer-manifest:
name: Verify installer manifest is up to date
needs: changes
if: github.event_name == 'merge_group' || ((needs.changes.outputs.go == 'true' || needs.changes.outputs.installer == 'true') && (github.event_name != 'push' || github.actor != 'github-merge-queue[bot]'))
runs-on: depot-ubuntu-24.04
timeout-minutes: 10
env:
GOFLAGS: -mod=vendor
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false

- name: Set up Go
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: go.mod
cache: true

- name: Verify installer manifests are up to date
run: |
make build-installer
git diff --exit-code -- \
dist/install.yaml \
dist/minimal-installer.yaml \
dist/quickstart-installer.yaml \
config/crd/bases/ \
config/rbac/

UNTRACKED_GENERATED="$(git ls-files --others --exclude-standard -- \
dist/install.yaml \
dist/minimal-installer.yaml \
dist/quickstart-installer.yaml \
config/crd/bases/ \
config/rbac/)"
if [[ -n "${UNTRACKED_GENERATED}" ]]; then
echo "assertion failed: generated installer artifacts must be tracked" >&2
printf '%s\n' "${UNTRACKED_GENERATED}" >&2
exit 1
fi

scan-fs:
name: Trivy filesystem scan
needs: changes
Expand Down Expand Up @@ -455,14 +513,15 @@ jobs:

publish-main:
name: Publish GHCR :main
needs: [changes, test, lint, scan-fs, lint-actions, e2e-kind, image-scan, terraform]
needs: [changes, test, lint, installer-manifest, scan-fs, lint-actions, e2e-kind, image-scan, terraform]
if: |
always() &&
github.event_name == 'push' &&
github.ref == 'refs/heads/main' &&
needs.changes.outputs.publish == 'true' &&
(needs.test.result == 'success' || needs.test.result == 'skipped') &&
(needs.lint.result == 'success' || needs.lint.result == 'skipped') &&
(needs.installer-manifest.result == 'success' || needs.installer-manifest.result == 'skipped') &&
(needs.scan-fs.result == 'success' || needs.scan-fs.result == 'skipped') &&
(needs.lint-actions.result == 'success' || needs.lint-actions.result == 'skipped') &&
(needs.e2e-kind.result == 'success' || needs.e2e-kind.result == 'skipped') &&
Expand Down
21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ VENDOR_STAMP := vendor/modules.txt
MODULE_FILES := go.mod $(wildcard go.sum)
ENVTEST_K8S_VERSION ?= 1.35.x
ENVTEST_ASSETS_DIR := $(shell pwd)/bin/envtest
MINIMAL_INSTALLER_MANIFEST := dist/minimal-installer.yaml
QUICKSTART_INSTALLER_MANIFEST := dist/quickstart-installer.yaml
INSTALLER_MANIFEST := dist/install.yaml
INSTALLER_RESOURCES := $(wildcard config/crd/bases/*.yaml) $(wildcard config/rbac/*.yaml)
MINIMAL_INSTALLER_SOURCES := config/default/kustomization.yaml config/default/namespace-coder-system.yaml deploy/deployment.yaml deploy/apiserver-service.yaml deploy/apiserver-apiservice.yaml
QUICKSTART_INSTALLER_SOURCES := $(wildcard config/quickstart/*.yaml)

.PHONY: vendor test test-integration setup-envtest build lint vuln verify-vendor codegen manifests docs-reference docs-reference-check docs-serve docs-build docs-check update-coder-docs-skill kind-dev-up kind-dev-ctx kind-dev-load-image kind-dev-status kind-dev-k9s kind-dev-down
.PHONY: vendor test test-integration setup-envtest build lint vuln verify-vendor codegen manifests build-installer docs-reference docs-reference-check docs-serve docs-build docs-check update-coder-docs-skill kind-dev-up kind-dev-ctx kind-dev-load-image kind-dev-status kind-dev-k9s kind-dev-down

$(VENDOR_STAMP): $(MODULE_FILES)
go mod tidy
Expand Down Expand Up @@ -42,6 +48,19 @@ verify-vendor:
manifests: $(VENDOR_STAMP)
bash ./hack/update-manifests.sh

$(MINIMAL_INSTALLER_MANIFEST): $(VENDOR_STAMP) hack/update-manifests.sh $(INSTALLER_RESOURCES) $(MINIMAL_INSTALLER_SOURCES) manifests
@mkdir -p $(dir $@)
GOFLAGS=$(GOFLAGS) go tool kustomize build --load-restrictor=LoadRestrictionsNone config/default > $@

$(QUICKSTART_INSTALLER_MANIFEST): $(VENDOR_STAMP) $(QUICKSTART_INSTALLER_SOURCES)
@mkdir -p $(dir $@)
GOFLAGS=$(GOFLAGS) go tool kustomize build --load-restrictor=LoadRestrictionsNone config/quickstart > $@

$(INSTALLER_MANIFEST): $(MINIMAL_INSTALLER_MANIFEST)
cp $(MINIMAL_INSTALLER_MANIFEST) $(INSTALLER_MANIFEST)

build-installer: $(MINIMAL_INSTALLER_MANIFEST) $(QUICKSTART_INSTALLER_MANIFEST) $(INSTALLER_MANIFEST)

codegen: $(VENDOR_STAMP)
bash ./hack/update-codegen.sh

Expand Down
6 changes: 6 additions & 0 deletions config/crd/bases/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- coder.com_codercontrolplanes.yaml
- coder.com_coderprovisioners.yaml
- coder.com_coderworkspaceproxies.yaml
9 changes: 9 additions & 0 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace-coder-system.yaml
- ../crd/bases
- ../rbac
- ../../deploy/deployment.yaml
- ../../deploy/apiserver-service.yaml
- ../../deploy/apiserver-apiservice.yaml
4 changes: 4 additions & 0 deletions config/default/namespace-coder-system.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: coder-system
16 changes: 16 additions & 0 deletions config/quickstart/codertemplate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: aggregation.coder.com/v1alpha1
kind: CoderTemplate
metadata:
name: default.quickstart-template
namespace: coder
spec:
organization: default
displayName: "Quickstart Template"
description: "Template applied by coder-k8s quickstart installer"
files:
main.tf: |
terraform {
required_version = ">= 1.0"
}

resource "null_resource" "quickstart" {}
9 changes: 9 additions & 0 deletions config/quickstart/coderworkspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: aggregation.coder.com/v1alpha1
kind: CoderWorkspace
metadata:
name: default.me.quickstart-workspace
namespace: coder
spec:
organization: default
templateName: quickstart-template
running: false
6 changes: 6 additions & 0 deletions config/quickstart/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace-coder.yaml
- codertemplate.yaml
- coderworkspace.yaml
4 changes: 4 additions & 0 deletions config/quickstart/namespace-coder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: coder
8 changes: 8 additions & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- auth-delegator-binding.yaml
- authentication-reader-binding.yaml
- clusterrolebinding.yaml
- role.yaml
- serviceaccount.yaml
Loading
Loading