Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Goreleaser

on:
push:
tags:
- "v*"

permissions:
contents: write

jobs:

release:
name: release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Setup Go
uses: actions/setup-go@v6
with:
go-version-file: "go.mod"

- name: Login to Quay.io
uses: docker/login-action@v4
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82 changes: 82 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
version: 2

project_name: virtwork

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...

builds:
- id: linux-amd64
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .CommitDate }}
main: ./cmd/virtwork/

archives:
- formats: [tar.gz]
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
formats: [zip]

dockers_v2:
- images:
- "quay.io/opdev/virtwork"

tags:
- latest
- "{{ .Tag }}"
dockerfile: ./Dockerfile.ci
labels:
org.opencontainers.image.created: "{{ .Date }}"
org.opencontainers.image.name: "{{ .ProjectName }}"
org.opencontainers.image.revision: "{{ .FullCommit }}"
org.opencontainers.image.version: "{{ .Version }}"
org.opencontainers.image.source: "{{ .GitURL }}"
org.opencontainers.image.description: "CLI tool that creates VMs on OpenShift clusters with KubeVirt and runs continuous CPU, memory, database, network, and disk I/O workloads"

annotations:
project: "{{ .ProjectName }}"

platforms:
- linux/amd64

extra_files:
- entrypoint.sh

ids:
- linux-amd64


changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

release:
footer: >-

---

Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
32 changes: 32 additions & 0 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Stage: Runtime image
# Copies binaries from the Goreleaser build context
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest

LABEL io.k8s.display-name="virtwork" \
io.k8s.description="Creates virtual machines on OpenShift with continuous workloads for metrics generation" \
io.openshift.tags="virtwork,kubevirt,openshift,workload-generator" \
summary="virtwork workload generator for OpenShift Virtualization" \
description="CLI tool that creates VMs on OpenShift clusters with KubeVirt and runs continuous CPU, memory, database, network, and disk I/O workloads" \
name="virtwork"

# sqlite-libs provides the runtime shared library for the CGO-compiled go-sqlite3
RUN microdnf install -y sqlite-libs && \
microdnf clean all

# Create data directory for audit database.
# OpenShift runs containers with an arbitrary UID but always GID 0.
# Setting group ownership to 0 and mode 775 ensures writability.
RUN mkdir -p /data && \
chown 1001:0 /data && \
chmod 775 /data

COPY linux/amd64/virtwork /usr/local/bin/virtwork
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

USER 1001
WORKDIR /data

ENV VIRTWORK_AUDIT_DB=/data/virtwork.db

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]