Skip to content

Commit f100c40

Browse files
committed
Add openshift specific files.
1 parent 9fdb537 commit f100c40

21 files changed

+808
-204
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Backstage lint
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'release-*'
7+
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version-file: 'backstage/.nvmrc'
19+
cache: 'yarn'
20+
cache-dependency-path: 'backstage/yarn.lock'
21+
22+
- name: Print environment
23+
run: |
24+
node --version
25+
yarn --version
26+
27+
- name: Install dependencies
28+
shell: bash
29+
working-directory: ./backstage
30+
run: yarn --prefer-offline --frozen-lockfile
31+
32+
- name: Lint all code
33+
shell: bash
34+
working-directory: ./backstage
35+
run: yarn backstage-cli repo lint
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Backstage unit tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'release-*'
7+
8+
jobs:
9+
unit-tests:
10+
name: Test
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version-file: 'backstage/.nvmrc'
20+
cache: 'yarn'
21+
cache-dependency-path: 'backstage/yarn.lock'
22+
23+
- name: Print environment
24+
run: |
25+
node --version
26+
yarn --version
27+
28+
- name: Install dependencies
29+
shell: bash
30+
working-directory: ./backstage
31+
run: yarn --prefer-offline --frozen-lockfile
32+
33+
- name: Run tests
34+
shell: bash
35+
working-directory: ./backstage
36+
run: |
37+
export PATH="./node_modules/.bin/:$PATH"
38+
yarn test
39+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
name: Dependabot
3+
4+
on:
5+
pull_request:
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
update-deps:
12+
name: Update deps
13+
runs-on: ubuntu-latest
14+
if: ${{ github.actor == 'dependabot[bot]' }}
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
ref: ${{ github.head_ref }}
20+
path: ./src/github.com/${{ github.repository }}
21+
fetch-depth: 0
22+
23+
- name: Setup Golang
24+
uses: openshift-knative/hack/actions/setup-go@main
25+
26+
- name: Install yq
27+
run: |
28+
go install github.com/mikefarah/yq/v3@latest
29+
30+
- name: Generate files
31+
working-directory: ./src/github.com/${{ github.repository }}
32+
run: make generate-release
33+
34+
- name: git push
35+
working-directory: ./src/github.com/${{ github.repository }}
36+
run: |
37+
if ! git diff --exit-code --quiet
38+
then
39+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
40+
git config --local user.name "github-actions[bot]"
41+
git add .
42+
git commit -m "Run make generate-release"
43+
git push
44+
fi
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Go unit tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'release-*'
7+
8+
jobs:
9+
build:
10+
name: go unit tests
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: 'go.mod'
21+
22+
- name: Test
23+
run: |
24+
go test -v -race ./...
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
name: Backstage plugin release
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- 'release-*'
7+
paths:
8+
- 'backstage/plugins/knative-event-mesh-backend/**'
9+
push:
10+
branches:
11+
- 'release-*'
12+
# Do not run on push to release-next branch. We don't want to publish the plugin on every push to release-next.
13+
# It might be okay to do so, but sobranch tool doesn't work well with release-next branch name.
14+
- '!release-next'
15+
# Ideally, we would want to only publish the plugin on NPM when there's an actual code change in the plugin.
16+
# However, using the path filters block workflow execution on initial branch creation.
17+
# So, let's publish on every push to a release branch.
18+
# see https://github.com/openshift-knative/backstage-plugins/pull/15#issuecomment-2333324099
19+
# paths:
20+
# - 'backstage/plugins/knative-event-mesh-backend/**'
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
25+
jobs:
26+
release:
27+
name: Release
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- uses: dorny/paths-filter@v3
35+
id: changes
36+
with:
37+
filters: |
38+
event_mesh_plugin:
39+
- 'backstage/plugins/knative-event-mesh-backend/**'
40+
41+
- name: Setup Golang
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version-file: go.mod
45+
46+
- name: Checkout openshift-knative/hack
47+
uses: actions/checkout@v4
48+
with:
49+
repository: 'openshift-knative/hack'
50+
ref: 'main'
51+
path: ./src/github.com/openshift-knative/hack
52+
53+
- name: Install sobranch
54+
run: |
55+
go install ./cmd/sobranch
56+
working-directory: ./src/github.com/openshift-knative/hack
57+
58+
- name: Setup release name for release branch push
59+
# do not run the step on PRs against release-next branch. run it on:
60+
# PRs against release-* branches, push to release-* branches, and creation of release-* branches
61+
if: github.event.created || steps.changes.outputs.event_mesh_plugin == 'true'
62+
run: |
63+
BRANCH=$(git rev-parse --abbrev-ref HEAD) #e.g. release-v1.33
64+
echo "Release branch: ${BRANCH}"
65+
66+
SO_RELEASE_NAME=$( $(go env GOPATH)/bin/sobranch --upstream-version "${BRANCH}") # input format: "release-v1.11" or "release-1.11" or "v1.11" or "1.11"
67+
# SO_RELEASE_NAME will be something like "release-1.33"
68+
echo "SO_RELEASE_NAME: ${SO_RELEASE_NAME}"
69+
70+
# split the release name to get the version number
71+
## e.g. release-1.33 -> 1.33
72+
BASE_RELEASE_VERSION=${SO_RELEASE_NAME#*-}
73+
echo "BASE_RELEASE_VERSION: ${BASE_RELEASE_VERSION}"
74+
75+
RELEASE_NAME="${BASE_RELEASE_VERSION}.0"
76+
77+
EXISTING_RELEASES=""
78+
79+
if EXISTING_RELEASES=$(npm view @openshift-knative/plugin-knative-event-mesh-backend versions --json); then
80+
echo "Package information fetched successfully"
81+
echo "Existing releases: ${EXISTING_RELEASES}"
82+
PATCH_RELEASES=$(echo "${EXISTING_RELEASES}" | grep ${BASE_RELEASE_VERSION})
83+
if [ -z "${PATCH_RELEASES}" ]; then
84+
echo "No existing PATCH_RELEASES found for ${BASE_RELEASE_VERSION}"
85+
echo "Going to publish a new .0 patch release"
86+
RELEASE_NAME="${BASE_RELEASE_VERSION}.0"
87+
else
88+
echo "Existing PATCH_RELEASES found for ${BASE_RELEASE_VERSION}"
89+
PATCH=$(echo "${PATCH_RELEASES}" | tail -1 | tr -d '"' | awk -F \. '{print $3+1}')
90+
RELEASE_NAME="${BASE_RELEASE_VERSION}.${PATCH}"
91+
fi
92+
else
93+
echo "Error fetching package information. Going to publish a new .0 patch release"
94+
RELEASE_NAME="${BASE_RELEASE_VERSION}.0"
95+
fi
96+
97+
echo "RELEASE_NAME: ${RELEASE_NAME}"
98+
echo "RELEASE_NAME=${RELEASE_NAME}" >> $GITHUB_ENV
99+
100+
- name: Setup Node.js
101+
uses: actions/setup-node@v4
102+
with:
103+
node-version-file: 'backstage/.nvmrc'
104+
cache: 'yarn'
105+
cache-dependency-path: 'backstage/yarn.lock'
106+
107+
- name: Print environment
108+
run: |
109+
node --version
110+
yarn --version
111+
112+
- name: Install dependencies
113+
shell: bash
114+
working-directory: ./backstage
115+
run: yarn --prefer-offline --frozen-lockfile
116+
117+
- name: Install tooling
118+
shell: bash
119+
working-directory: ./backstage
120+
run: npm install @backstage/cli -g
121+
122+
- name: Run tests
123+
shell: bash
124+
working-directory: ./backstage
125+
run: |
126+
export PATH="./node_modules/.bin/:$PATH"
127+
yarn test
128+
129+
- name: Build
130+
shell: bash
131+
working-directory: ./backstage
132+
run: |
133+
export PATH="./node_modules/.bin/:$PATH"
134+
yarn tsc
135+
yarn build:all
136+
137+
- name: Update version of knative-event-mesh-backend plugin
138+
# do not run the step on PRs against release-next branch. run it on:
139+
# PRs against release-* branches, push to release-* branches, and creation of release-* branches
140+
if: github.event.created || steps.changes.outputs.event_mesh_plugin == 'true'
141+
shell: bash
142+
working-directory: ./backstage/plugins/knative-event-mesh-backend
143+
run: |
144+
export PATH="./node_modules/.bin/:$PATH"
145+
yarn version --new-version ${RELEASE_NAME} --no-git-tag-version
146+
147+
- name: Prepack knative-event-mesh-backend plugin
148+
shell: bash
149+
working-directory: ./backstage/plugins/knative-event-mesh-backend
150+
run: |
151+
export PATH="./node_modules/.bin/:$PATH"
152+
yarn prepack
153+
154+
- name: Publish knative-event-mesh-backend plugin
155+
uses: JS-DevTools/npm-publish@v3
156+
# do not run the step on PRs against release-next branch. run it on:
157+
# PRs against release-* branches, push to release-* branches, and creation of release-* branches
158+
if: github.event.created || steps.changes.outputs.event_mesh_plugin == 'true'
159+
with:
160+
token: ${{ secrets.NPM_TOKEN }}
161+
access: public
162+
package: backstage/plugins/knative-event-mesh-backend
163+
tag: latest
164+
165+
- name: Postpack knative-event-mesh-backend plugin
166+
shell: bash
167+
working-directory: ./backstage/plugins/knative-event-mesh-backend
168+
run: |
169+
export PATH="./node_modules/.bin/:$PATH"
170+
yarn postpack

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#This makefile is used by ci-operator
2+
3+
CGO_ENABLED=0
4+
GOOS=linux
5+
BRANCH=
6+
TEST=
7+
IMAGE=
8+
TEST_IMAGE_TAG ?= latest
9+
10+
11+
test-e2e:
12+
./openshift/e2e-tests.sh
13+
.PHONY: test-e2e
14+
15+
# Generate an aggregated knative release yaml file, as well as a CI file with replaced image references
16+
generate-release:
17+
./openshift/release/generate-release.sh
18+
.PHONY: generate-release

OWNERS

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
# Sponsored by the Eventing WG
2-
# At least one WG lead from https://github.com/knative/community/blob/main/working-groups/WORKING-GROUPS.md#eventing
3-
# must be in the "approvers" list.
1+
# The OWNERS file is used by prow to automatically merge approved PRs.
2+
3+
# DO NOT EDIT! File generated via https://github.com/openshift-knative/hack/tree/main/config.
4+
45
approvers:
5-
- technical-oversight-committee
6-
- knative-release-leads
7-
- eventing-writers
8-
- backstage-plugins-writers
6+
- aliok
7+
- Cali0707
8+
- creydr
9+
- Kaustubh-pande
10+
- lberk
11+
- matzew
12+
- rudyredhat1
913

1014
reviewers:
11-
- backstage-plugins-reviewers
15+
- aliok
16+
- Cali0707
17+
- creydr
18+
- lberk
19+
- matzew

0 commit comments

Comments
 (0)