Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add github release automation for tekton tasks #549

Merged
merged 1 commit into from
May 22, 2023
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
45 changes: 45 additions & 0 deletions .github/workflows/release-tekton-tasks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release KubeVirt Tekton Tasks

on:
repository_dispatch:
types: [release-tekton-tasks]

jobs:
release-tekton-tasks:
name: Release KubeVirt Tekton Tasks
runs-on: ubuntu-latest
steps:
- name: Checkout code
if: ${{ github.event.client_payload.release_version }} != ''
uses: actions/checkout@v3
- run: |
RELEASE_VERSION=${{ github.event.client_payload.release_version }}
KUBERNETES_OUTPUT_FILE=./data/tekton-tasks/kubevirt-tekton-tasks-kubernetes.yaml
OKD_OUTPUT_FILE=./data/tekton-tasks/kubevirt-tekton-tasks-okd.yaml

mkdir -p ./data/tekton-tasks/kubernetes
mkdir -p ./data/tekton-tasks/okd

curl -L https://github.com/kubevirt/kubevirt-tekton-tasks/releases/download/${RELEASE_VERSION}/kubevirt-tekton-tasks-okd.yaml > ${OKD_OUTPUT_FILE}
curl -L https://github.com/kubevirt/kubevirt-tekton-tasks/releases/download/${RELEASE_VERSION}/kubevirt-tekton-tasks-kubernetes.yaml > ${KUBERNETES_OUTPUT_FILE}

- name: Create pull request
if: ${{ github.event.client_payload.release_version }} != ''
uses: peter-evans/create-pull-request@v4
with:
token: ${{ github.token }}
commit-message: "chore: update tekton-tasks manifests to ${{ github.event.client_payload.release_version }}"
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: true
branch: "tekton-tasks-${{ github.event.client_payload.release_version }}"
delete-branch: true
title: "Update tekton-tasks manifests to ${{ github.event.client_payload.release_version }}"
body: |
Update tekton-tasks manifests to version ${{ github.event.client_payload.release_version }}

**Release note**:
```release-note
Update tekton-tasks-bundle to ${{ github.event.client_payload.release_version }}
```
draft: false
5 changes: 2 additions & 3 deletions internal/tekton-bundle/tekton-bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
v1 "k8s.io/api/core/v1"
rbac "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/util/yaml"
"kubevirt.io/ssp-operator/internal/common"
)

const (
Expand Down Expand Up @@ -81,9 +80,9 @@ func getPipelineBundlePath(isOpenshift bool) string {

func getTasksBundlePath(isOpenshift bool) string {
if isOpenshift {
return filepath.Join(tektonTasksOKDBundleDir, "kubevirt-tekton-tasks-okd-"+common.TektonTasksVersion+".yaml")
return filepath.Join(tektonTasksOKDBundleDir, "kubevirt-tekton-tasks-okd.yaml")
}
return filepath.Join(tektonTasksKubernetesBundleDir, "kubevirt-tekton-tasks-kubernetes-"+common.TektonTasksVersion+".yaml")
return filepath.Join(tektonTasksKubernetesBundleDir, "kubevirt-tekton-tasks-kubernetes.yaml")
}

func readFolder(folderPath string) ([][]byte, error) {
Expand Down
5 changes: 2 additions & 3 deletions internal/tekton-bundle/tekton-bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"kubevirt.io/ssp-operator/internal/common"
)

const (
Expand All @@ -32,12 +31,12 @@ var _ = Describe("Tekton bundle", func() {

It("should return correct task path on okd", func() {
path := getTasksBundlePath(true)
Expect(path).To(Equal("/data/tekton-tasks/okd/kubevirt-tekton-tasks-okd-" + common.TektonTasksVersion + ".yaml"))
Expect(path).To(Equal("/data/tekton-tasks/okd/kubevirt-tekton-tasks-okd.yaml"))
ksimon1 marked this conversation as resolved.
Show resolved Hide resolved
})

It("should return correct task path on kubernetes", func() {
path := getTasksBundlePath(false)
Expect(path).To(Equal("/data/tekton-tasks/kubernetes/kubevirt-tekton-tasks-kubernetes-" + common.TektonTasksVersion + ".yaml"))
Expect(path).To(Equal("/data/tekton-tasks/kubernetes/kubevirt-tekton-tasks-kubernetes.yaml"))
})

It("should load correct files and convert them", func() {
Expand Down