Skip to content

chore(deps): bump k8s.io/apimachinery from 0.32.0 to 0.32.1 #80

chore(deps): bump k8s.io/apimachinery from 0.32.0 to 0.32.1

chore(deps): bump k8s.io/apimachinery from 0.32.0 to 0.32.1 #80

Workflow file for this run

name: CI
on:
push:
branches:
- main
paths:
- "pruner/**"
- "go.mod"
- "go.sum"
- "Dockerfile"
- ".github/workflows/ci.yml"
pull_request:
branches:
- main
paths:
- "pruner/**"
- "go.mod"
- "go.sum"
- "Dockerfile"
- ".github/workflows/ci.yml"
workflow_dispatch:
env:
REGISTRY: ghcr.io
OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
go: ["1.21", "1.22", "1.23"]
name: Go ${{ matrix.go }} version
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Codecov Test Run
working-directory: pruner/
run: |
go get
go test -v -race -coverprofile=coverage.txt -covermode=atomic
- name: Codecov Test Upload
uses: codecov/codecov-action@v4
build:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Set Tag Name
run: |
echo "TAG=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV
echo "DATE=v$(echo `date +'%Y.%m'`)" >> $GITHUB_ENV
- name: Check for changes in 'pruner' folder
id: check_changes
run: |
git diff --exit-code HEAD^ HEAD -- pruner || echo "changed=true" >> $GITHUB_ENV
- name: Login to DockerHub
if: ${{ env.changed == 'true' }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.OWNER }}
password: ${{ github.token }}
- name: Set up QEMU
if: ${{ env.changed == 'true' }}
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
if: ${{ env.changed == 'true' }}
id: buildx
uses: docker/setup-buildx-action@v3
env:
DOCKER_BUILDKIT: 1
- name: Build and push Docker image
if: ${{ env.changed == 'true' }}
uses: docker/build-push-action@v5
env:
DOCKER_BUILD_SUMMARY: true
DOCKER_BUILD_CHECKS_ANNOTATIONS: true
DOCKER_BUILD_RECORD_RETENTION_DAYS: 10
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
build-args: |
BUILD_ID=${{ env.DATE }}
pull: true
push: true
sbom: true
provenance: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.REPO_NAME }}:${{ env.TAG == 'main' && 'latest' || env.TAG }},${{ env.REGISTRY }}/${{ env.OWNER }}/${{ env.REPO_NAME }}:${{ env.DATE }}
- name: Run Trivy vulnerability scanner
if: ${{ env.changed == 'true' }}
uses: aquasecurity/trivy-action@master
with:
image-ref: ghcr.io/${{ env.OWNER }}/${{ env.REPO_NAME }}:${{ env.TAG == 'main' && 'latest' || env.TAG }}
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab
if: ${{ env.changed == 'true' }}
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
pruner:
runs-on: ubuntu-latest
needs: [build]
if: ${{ contains(github.ref, 'main') }}
steps:
- uses: actions/delete-package-versions@v5
with:
package-name: 'pod-pruner'
package-type: 'container'
min-versions-to-keep: 10
# ignore-versions: '^(0|[1-9]\\d*)\\.0\\.0$|^(latest|v\\d{4}\\.\\d{2})$'
k8s-test:
runs-on: ubuntu-latest
needs: [build]
if: ${{ ! contains(github.ref, 'main') }}
steps:
- name: Create k8s Kind Cluster
uses: helm/[email protected]
- name: Checkout
uses: actions/checkout@v4
- name: Run K8s test
run: |
kubectl cluster-info
export NS=`cat deployment/kustomization.yml | grep namespace | awk '{ print $2 }'`
if [ -z "$NS" ]; then
export NS='pod-pruner'
fi
kubectl create namespace $NS
kubectl kustomize deployment/ | kubectl apply -f -
kubectl get all -A
auto-approve:
runs-on: ubuntu-latest
needs: [test, build, k8s-test]
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Auto Approve PR
uses: actions/github-script@v7
with:
script: |
github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
event: "APPROVE"
})
auto-preview:
runs-on: ubuntu-latest
needs: [auto-approve]
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: Add Preview Label
uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['preview']
})
# auto-merge:
# runs-on: ubuntu-latest
# needs: [auto-approve]
# if: ${{ github.event_name == 'pull_request' }}
# env:
# PR_NUMBER: ${{ github.event.number }}
# steps:
# - name: Check out repository code
# uses: actions/checkout@v4
# - name: Auto Merge PR
# uses: actions/github-script@v7
# with:
# github-token: ${{ github.token }}
# script: |
# await github.rest.pulls.merge({
# merge_method: 'squash',
# owner: context.repo.owner,
# pull_number: process.env.PR_NUMBER,
# repo: context.repo.repo
# });