fix(ci): update devcontainers, github actions config, bats action (#928)

This commit is contained in:
Luigi Operoso 2023-11-13 00:26:13 +01:00 committed by GitHub
parent 3682468b5f
commit 138e569841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 46 deletions

View File

@ -1,43 +1,56 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the // For format details, see https://aka.ms/devcontainer.json
// README at: https://github.com/devcontainers/templates/tree/main/src/kubernetes-helm-minikube
{ {
"name": "Kubernetes - Minikube-in-Docker", "name": "Jenkins kubernetes operator devcontainer",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "image": "mcr.microsoft.com/devcontainers/base:bookworm",
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
"features": { "features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": { "ghcr.io/devcontainers/features/docker-in-docker:2": {
"enableNonRootDocker": "true", "enableNonRootDocker": "true",
"moby": "true" "moby": "true"
}, },
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": { "ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "latest", "version": "latest",
"helm": "latest", "helm": "latest",
"minikube": "latest" "minikube": "none"
}, },
"ghcr.io/devcontainers/features/go:1": { "ghcr.io/devcontainers/features/go:1": {
"version": "1.15", "version": "1.15",
"golangciLintVersion": "1.26.0" "golangciLintVersion": "1.26.0"
}, },
"ghcr.io/mpriscella/features/kind:1": { "ghcr.io/mpriscella/features/kind:1": {
"version": "latest" "version": "latest"
}, },
"ghcr.io/edouard-lopez/devcontainer-features/bats:0": { "ghcr.io/edouard-lopez/devcontainer-features/bats:0": {
"version": "latest" "version": "latest"
} },
} "ghcr.io/brokenpip3/devcontainers-bats/bats-libs:0": {
// Use 'forwardPorts' to make a list of ports inside the container available locally. }
// "forwardPorts": [], },
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "go version",
// "postCreateCommand": "kubectl version",
// Use 'postStartCommand' to run commands after the container is created like starting minikube. // "postStartCommand": "nohup bash -c 'minikube start &' > minikube.log 2>&1",
// "postStartCommand": "nohup bash -c 'minikube start &' > minikube.log 2>&1",
// Configure tool-specific properties. // Configure tool-specific properties.
// "customizations": {}, "customizations": {
"codespaces": {
"openFiles": [
"Makefile"
]
},
// install some vscode extensions
"vscode": {
"extensions": [
"golang.Go",
"jetmartin.bats",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"budparr.language-hugo-vscode",
"GitHub.copilot",
"GitHub.copilot-chat"
]
}
},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. // "remoteUser": "root"
// "remoteUser": "root"
} }

View File

@ -4,11 +4,25 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "daily" interval: "daily"
groups:
golang:
patterns:
- "*"
- package-ecosystem: "npm" - package-ecosystem: "npm"
directory: "/website" directory: "/website"
schedule: schedule:
interval: "daily" interval: "daily"
groups:
npm:
patterns:
- "*"
- package-ecosystem: "github-actions" - package-ecosystem: "github-actions"
directory: "/" directory: "/"
schedule: schedule:
interval: "weekly" interval: "daily"
groups:
actions:
patterns:
- "*"

View File

@ -44,13 +44,13 @@ jobs:
- name: Ensure Golang runtime dependencies - name: Ensure Golang runtime dependencies
run: make go-dependencies run: make go-dependencies
- name: Setup BATS - name: Setup Bats and libs
uses: mig4/setup-bats@v1 uses: brokenpip3/setup-bats-libs@1.5.2
with: with:
bats-version: 1.9.0 support-path: "${{ github.workspace }}/.bats/bats-support"
assert-path: "${{ github.workspace }}/.bats/bats-assert"
- name: Setup Bats libs detik-path: "${{ github.workspace }}/.bats/bats-detik"
uses: brokenpip3/setup-bats-libs@0.1.0 file-path: "${{ github.workspace }}/.bats/bats-file"
- name: Kind setup - name: Kind setup
uses: helm/kind-action@v1.5.0 uses: helm/kind-action@v1.5.0
@ -58,4 +58,6 @@ jobs:
cluster_name: ${{env.KIND_CLUSTER_NAME}} cluster_name: ${{env.KIND_CLUSTER_NAME}}
- name: Jenkins Operator - bats tests - name: Jenkins Operator - bats tests
env:
BATS_LIB_PATH: "${{ github.workspace }}/.bats"
run: make bats-tests run: make bats-tests

View File

@ -387,11 +387,11 @@ ifndef BUILD_PRESENT
bats-tests: container-runtime-build-amd64 ## Run bats tests bats-tests: container-runtime-build-amd64 ## Run bats tests
@echo "+ $@" @echo "+ $@"
kind load docker-image ${IMAGE_NAME} --name $(KIND_CLUSTER_NAME) kind load docker-image ${IMAGE_NAME} --name $(KIND_CLUSTER_NAME)
OPERATOR_IMAGE="${IMAGE_NAME}" TERM=xterm bats -T -p -x test/bats OPERATOR_IMAGE="${IMAGE_NAME}" TERM=xterm bats -T -p test/bats
else else
bats-tests: ## Run bats tests bats-tests: ## Run bats tests
@echo "+ $@" @echo "+ $@"
OPERATOR_IMAGE="${IMAGE_NAME}" TERM=xterm bats -T -p -x test/bats OPERATOR_IMAGE="${IMAGE_NAME}" TERM=xterm bats -T -p test/bats
endif endif
.PHONY: crc-start .PHONY: crc-start

View File

@ -1,5 +1,5 @@
_common_setup() { _common_setup() {
export BATS_LIB_PATH="/usr/lib/" export BATS_LIB_PATH="${BATS_LIB_PATH}:/usr/lib"
bats_load_library bats-support bats_load_library bats-support
bats_load_library bats-assert bats_load_library bats-assert
bats_load_library bats-file bats_load_library bats-file