Skip to content

Commit

Permalink
fix(ci): update devcontainers, github actions config, bats action (#928)
Browse files Browse the repository at this point in the history
  • Loading branch information
brokenpip3 authored Nov 12, 2023
1 parent 3682468 commit 138e569
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 46 deletions.
85 changes: 49 additions & 36 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,56 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/kubernetes-helm-minikube
// For format details, see https://aka.ms/devcontainer.json
{
"name": "Kubernetes - Minikube-in-Docker",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bookworm",
"name": "Jenkins kubernetes operator devcontainer",
"image": "mcr.microsoft.com/devcontainers/base:bookworm",

"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"enableNonRootDocker": "true",
"moby": "true"
},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "latest",
"helm": "latest",
"minikube": "latest"
},
"ghcr.io/devcontainers/features/go:1": {
"version": "1.15",
"golangciLintVersion": "1.26.0"
},
"ghcr.io/mpriscella/features/kind:1": {
"version": "latest"
},
"ghcr.io/edouard-lopez/devcontainer-features/bats:0": {
"version": "latest"
}
}
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"enableNonRootDocker": "true",
"moby": "true"
},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "latest",
"helm": "latest",
"minikube": "none"
},
"ghcr.io/devcontainers/features/go:1": {
"version": "1.15",
"golangciLintVersion": "1.26.0"
},
"ghcr.io/mpriscella/features/kind:1": {
"version": "latest"
},
"ghcr.io/edouard-lopez/devcontainer-features/bats:0": {
"version": "latest"
},
"ghcr.io/brokenpip3/devcontainers-bats/bats-libs:0": {
}
},
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "kubectl version",
"postCreateCommand": "go 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.
// "customizations": {},
// Configure tool-specific properties.
"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"
}
16 changes: 15 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,25 @@ updates:
directory: "/"
schedule:
interval: "daily"
groups:
golang:
patterns:
- "*"

- package-ecosystem: "npm"
directory: "/website"
schedule:
interval: "daily"
groups:
npm:
patterns:
- "*"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
interval: "daily"
groups:
actions:
patterns:
- "*"
14 changes: 8 additions & 6 deletions .github/workflows/auto-tests-bats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,20 @@ jobs:
- name: Ensure Golang runtime dependencies
run: make go-dependencies

- name: Setup BATS
uses: mig4/setup-bats@v1
- name: Setup Bats and libs
uses: brokenpip3/setup-bats[email protected]
with:
bats-version: 1.9.0

- name: Setup Bats libs
uses: brokenpip3/setup-bats[email protected]
support-path: "${{ github.workspace }}/.bats/bats-support"
assert-path: "${{ github.workspace }}/.bats/bats-assert"
detik-path: "${{ github.workspace }}/.bats/bats-detik"
file-path: "${{ github.workspace }}/.bats/bats-file"

- name: Kind setup
uses: helm/[email protected]
with:
cluster_name: ${{env.KIND_CLUSTER_NAME}}

- name: Jenkins Operator - bats tests
env:
BATS_LIB_PATH: "${{ github.workspace }}/.bats"
run: make bats-tests
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,11 @@ ifndef BUILD_PRESENT
bats-tests: container-runtime-build-amd64 ## Run bats tests
@echo "+ $@"
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
bats-tests: ## Run bats tests
@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

.PHONY: crc-start
Expand Down
2 changes: 1 addition & 1 deletion test/bats/test_helper.bash
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
_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-assert
bats_load_library bats-file
Expand Down

0 comments on commit 138e569

Please sign in to comment.