Skip to content

Commit

Permalink
Merge branch 'main' into chore/logo
Browse files Browse the repository at this point in the history
  • Loading branch information
vadasambar authored Feb 14, 2024
2 parents 0a4d6c9 + 16892c4 commit 3ba0baa
Show file tree
Hide file tree
Showing 106 changed files with 1,522 additions and 388 deletions.
12 changes: 12 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// For format details, see https://containers.dev
{
"name": "container-image-csi-driver dev container",
"image": "ghcr.io/warm-metal/container-image-csi-driver/devcontainer:latest",

// Setup the go environment and mount into the dev container at the expected location
"workspaceFolder": "/go/src/github.com/warm-metal/container-image-csi-driver",
"workspaceMount": "source=${localWorkspaceFolder},target=/go/src/github.com/warm-metal/container-image-csi-driver,type=bind,consistency=cached",

// Copy over welcome message
"postCreateCommand": "sudo cp .devcontainer/welcome.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt"
}
7 changes: 7 additions & 0 deletions .devcontainer/welcome.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
👋 Welcome to your development environment for Container Image CSI Driver!

This debian dev container image contains all tools needed for development.

Get started right away! 🚀

Check out the guide in docs/running-locally.md
1 change: 1 addition & 0 deletions .github/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM mcr.microsoft.com/devcontainers/base:ubuntu
47 changes: 47 additions & 0 deletions .github/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// For format details, see https://containers.dev
{
"name": "container-image-csi-driver dev container",
// Workaround as mentioned in
// https://github.com/devcontainers/ci/issues/191#issuecomment-1473518609

//"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"build": {
"dockerfile": "./Dockerfile",
"context": "."
},

"otherPortsAttributes": {
"onAutoForward": "silent"
},

"features": {
"ghcr.io/devcontainers/features/go:1": {
"version": "1.19"
},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "latest",
"helm": "latest",
"minikube": "none"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"dockerDashComposeVersion": "v2"
},
"ghcr.io/devcontainers-contrib/features/kind:1": {}
},

"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "zsh"
}
}
},
"extensions": [
"golang.go"
]
}
}
}
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @warm-metal/csi-maintainers
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore: [skip ci]"
include: "scope"
8 changes: 4 additions & 4 deletions .github/workflows/backward-compatibility.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: backward-compatibility-5mins
on:
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]
branches: [main]
workflow_dispatch:
jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Start a kind cluster with containerd
uses: helm/kind-action@v1.4.0
uses: helm/kind-action@v1.8.0
with:
cluster_name: kind-${{ github.run_id }}
kubectl_version: "v1.25.2"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/containerd.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: containerd-11mins
on:
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]
branches: [main]
workflow_dispatch:
jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Start a kind cluster with containerd
uses: helm/kind-action@v1.4.0
uses: helm/kind-action@v1.8.0
with:
cluster_name: kind-${{ github.run_id }}
kubectl_version: "v1.25.2"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/cri-o.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
name: cri-o-10mins
on:
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]
branches: [main]
workflow_dispatch:
jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Start a kind cluster with crio
uses: helm/kind-action@v1.4.0
uses: helm/kind-action@v1.8.0
with:
cluster_name: kind-${{ github.run_id }}
kubectl_version: "v1.25.2"
node_image: "docker.io/warmmetal/kindest-node-crio:v1.25.2-csi-driver-image"
node_image: "docker.io/warmmetal/kindest-node-crio:v1.25.2-container-image-csi-driver"
- name: Install private registry
run: ./hack/ci/setup_private_registry.sh
- name: Build image
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/devcontainer-build-and-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Dev Container Build and Push Image

on:
push:
branches: [main]
paths:
- .github/workflows/devcontainer-build-and-push.yaml
- '.github/.devcontainer/**'
pull_request:
paths:
- .github/workflows/devcontainer-build-and-push.yaml
- '.github/.devcontainer/**'

permissions:
contents: read
packages: write

jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install updated skopeo
# https://github.com/devcontainers/ci/issues/191#issuecomment-1416384710
run: |
sudo apt purge buildah golang-github-containers-common podman skopeo
sudo apt autoremove --purge
REPO_URL="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable"
source /etc/os-release
sudo sh -c "echo 'deb ${REPO_URL}/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list"
sudo wget -qnv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O Release.key
sudo apt-key add Release.key
sudo apt-get update
sudo apt-get install skopeo -y
- name: Pre-build dev container image
uses: devcontainers/ci@v0.3
with:
subFolder: .github
imageName: ghcr.io/${{ github.repository }}/devcontainer
cacheFrom: ghcr.io/${{ github.repository }}/devcontainer
platform: linux/amd64,linux/arm64
push: always
2 changes: 1 addition & 1 deletion .github/workflows/docker-containerd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: opsgang/ga-setup-minikube@v0.1.2
with:
minikube-version: '1.20.0'
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/images-build-and-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Create and publish the container image

on:
push:
branches:
- '*'
tags:
- 'v*'

env:
BASE_REPOSITORY: warm-metal/container-image-csi-driver
BASE_DEFAULT_BRANCH: main
BASE_IMAGE_NAME: warmmetal/csi-image
FORK_IMAGE_NAME: ghcr.io/${{ github.repository }}

permissions:
packages: write

jobs:
build-and-push-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.repository == env.BASE_REPOSITORY
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Log in to the GitHub Container registry
uses: docker/login-action@v3
if: github.repository != env.BASE_REPOSITORY
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
name=${{ env.BASE_IMAGE_NAME }},enable=${{ github.repository == env.BASE_REPOSITORY }}
name=${{ env.FORK_IMAGE_NAME }},enable=${{ github.repository != env.BASE_REPOSITORY }}
tags: |
# set 'latest' tag for default branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', env.BASE_DEFAULT_BRANCH) }}
# set image tag based on GitHub release tag
type=semver,pattern={{version}},prefix=v
# set the image tag based on the branch
# https://github.com/docker/metadata-action/issues/247#issuecomment-1511259674
type=ref,event=branch,enable=${{ github.ref_name != env.BASE_DEFAULT_BRANCH }}
flavor: |
latest=false
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
27 changes: 27 additions & 0 deletions .github/workflows/images-cleanup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Delete old container images

on:
schedule:
- cron: "0 0 * * *" # Source: https://crontab.guru/every-day

permissions:
packages: write

env:
BASE_REPOSITORY: warm-metal/container-image-csi-driver

jobs:
clean-ghcr:
name: Delete old unused container images
runs-on: ubuntu-latest
steps:
- uses: actions/delete-package-versions@v5
if: github.repository != env.BASE_REPOSITORY
with:
owner: ${{ github.repository_owner }}
package-name: ${{ github.event.repository.name }}
package-type: 'container'
min-versions-to-keep: 1
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# Ignore any semver or 'latest'
ignore-versions: '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?|latest$'
37 changes: 37 additions & 0 deletions .github/workflows/metrics.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: test-metrics-5m
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Start a kind cluster with containerd
uses: helm/kind-action@v1.8.0
with:
cluster_name: kind-${{ github.run_id }}
kubectl_version: "v1.25.2"
config: ./hack/ci/containerd-cluster-conf.yaml
- name: Build image
run: ./hack/ci/build.sh
- name: Set image version
run: |
echo "VALUE_FILE=charts/warm-metal-csi-driver/values.yaml" >> "$GITHUB_ENV"
echo "IMAGE_TAG=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
echo "HELM_NAME=wm-csi-integration-tests" >> "$GITHUB_ENV"
- name: Install the CSI Driver
run: |
trap "kubectl -n kube-system describe po" ERR
helm install ${HELM_NAME} charts/warm-metal-csi-driver -n kube-system \
-f ${VALUE_FILE} \
--set csiPlugin.image.tag=${IMAGE_TAG} \
--wait \
--debug
- name: Test metrics
run: ./test/integration/test-metrics.sh
- name: Uninstall the CSI Driver
run: helm uninstall -n kube-system ${HELM_NAME} --wait
8 changes: 4 additions & 4 deletions .github/workflows/restart-ds-containerd.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: restart-ds-containerd-5mins
on:
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]
branches: [main]
workflow_dispatch:
jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Start a kind cluster with containerd
uses: helm/kind-action@v1.4.0
uses: helm/kind-action@v1.8.0
with:
cluster_name: kind-${{ github.run_id }}
kubectl_version: "v1.25.2"
Expand Down
Loading

0 comments on commit 3ba0baa

Please sign in to comment.