Skip to content

Commit bcbc8e6

Browse files
Prachi030510Prachi Shivanand Anureashimagarg27
authored
Travis to Github Action Migration (#283)
* travis to github action migration * add coverage scripts * fix: use full ubi8/ubi base (has rpcbind and nfs-utils) * Fix Dockerfile image tag: ubi8/ubi:8 -> ubi8/ubi:latest Signed-off-by: Ashima-Ashima1 <[email protected]> * Fix to build debian and rpm pkg (#287) Signed-off-by: Ashima-Ashima1 <[email protected]> --------- Signed-off-by: Ashima-Ashima1 <[email protected]> Co-authored-by: Prachi Shivanand Anure <[email protected]> Co-authored-by: Ashima-Ashima1 <[email protected]> Co-authored-by: Ashima <[email protected]>
1 parent ed03497 commit bcbc8e6

File tree

10 files changed

+310
-114
lines changed

10 files changed

+310
-114
lines changed

.github/workflows/release.yml

Lines changed: 127 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,109 @@
1-
name: Release
1+
name: CI & Release
22

33
on:
44
push:
55
branches:
66
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
714

815
jobs:
16+
common-setup:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
should_release: ${{ steps.check_release.outputs.should_release }}
20+
21+
steps:
22+
- name: Checkout Code
23+
uses: actions/checkout@v5
24+
25+
- name: Print Go Version
26+
run: go version
27+
28+
- name: Get last commit message
29+
id: check_commit
30+
run: |
31+
message=$(git log -1 --pretty=%B)
32+
message="${message//'%'/'%25'}" # Escape '%'
33+
message="${message//$'\n'/'%0A'}" # Escape newlines
34+
message="${message//$'\r'/'%0D'}" # Escape carriage returns
35+
echo "message=$message" >> "$GITHUB_OUTPUT"
36+
shell: bash
37+
38+
- name: Check Commit Message
39+
run: |
40+
echo "Commit Message: ${{ steps.check_commit.outputs.message }}"
41+
42+
- name: Check if release should be triggered
43+
id: check_release
44+
run: |
45+
if [[ "${{ steps.check_commit.outputs.message }}" == *"publish"* ]]; then
46+
echo "should_release=true" >> "$GITHUB_OUTPUT"
47+
echo "Debian/RPM packages will be created"
48+
else
49+
echo "should_release=false" >> "$GITHUB_OUTPUT"
50+
echo "Debian/RPM packages will not be created"
51+
fi
52+
53+
build-and-test:
54+
needs: common-setup
55+
runs-on: ubuntu-latest
56+
permissions:
57+
contents: write # needed to push coverage to gh-pages
58+
pull-requests: write # needed to comment on PRs
59+
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v5
63+
with:
64+
fetch-depth: 0
65+
66+
- name: Install system dependencies (bc + docker)
67+
run: |
68+
sudo apt-get update -qq
69+
sudo apt-get install -y bc docker-ce-cli
70+
71+
- name: Prepare environment
72+
run: |
73+
export GO111MODULE=on
74+
go mod tidy
75+
make deps
76+
77+
- name: Check code formatting
78+
run: make fmt
79+
80+
- name: Run unit tests
81+
run: make test
82+
83+
- name: Generate coverage
84+
run: |
85+
make coverage
86+
./scripts/calculateCoverage.sh
87+
touch "Passing" || touch "Failed"
88+
89+
- name: Build driver image
90+
run: |
91+
make driver
92+
env:
93+
RHSM_USER: ${{ secrets.RHSM_USER }}
94+
RHSM_PASS: ${{ secrets.RHSM_PASS }}
95+
96+
- name: Publish coverage
97+
if: success()
98+
env:
99+
GHE_TOKEN: ${{ secrets.GHE_TOKEN }}
100+
run: |
101+
./scripts/publishCoverage.sh
102+
9103
release:
10-
permissions: write-all
104+
needs: common-setup
105+
if: needs.common-setup.outputs.should_release == 'true'
106+
permissions: write-all
11107
runs-on: ubuntu-latest
12108

13109
strategy:
@@ -20,55 +116,37 @@ jobs:
20116
APP_VERSION: 1.0.5
21117

22118
steps:
23-
- name: Checkout Code
24-
uses: actions/checkout@v5
25-
26-
- name: Print Go Version
27-
run: go version
28-
29-
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@v3
31-
with:
32-
languages: "go"
33-
34-
- name: Run Unit Tests for cos csi mounter
35-
run: sudo make ut-coverage -C ${{ matrix.package_dir }}
119+
- name: Checkout Code
120+
uses: actions/checkout@v5
36121

37-
- name: Build Debian and RPM packages for cos-csi-mounter systemd service
38-
run: |
122+
- name: Initialize CodeQL
123+
uses: github/codeql-action/init@v3
124+
with:
125+
languages: "go"
126+
127+
- name: Build Debian and RPM packages for cos-csi-mounter systemd service
128+
run: |
39129
cd ${{ matrix.package_dir }}
40130
make packages
41131
42-
- name: Get last commit message
43-
id: check_commit
44-
run: |
45-
message=$(git log -1 --pretty=%B)
46-
message="${message//'%'/'%25'}" # Escape '%'
47-
message="${message//$'\n'/'%0A'}" # Escape newlines
48-
message="${message//$'\r'/'%0D'}" # Escape carriage returns
49-
echo "message=$message" >> "$GITHUB_OUTPUT"
50-
shell: bash
51-
52-
- name: Check Commit Message
53-
run: |
54-
echo "Commit Message: ${{ steps.check_commit.outputs.message }}"
132+
- name: Latest Version (Tag and Release)
133+
if: success()
134+
id: release
135+
uses: softprops/action-gh-release@v2
136+
with:
137+
files: |
138+
/home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.deb.tar.gz
139+
/home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.deb.tar.gz.sha256
140+
/home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.rpm.tar.gz
141+
/home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.rpm.tar.gz.sha256
142+
tag_name: v1.0.5
143+
name: v1.0.5
144+
body: |
145+
## 🚀 What’s New
146+
- Fix for rclone mount hang issue
147+
- Add support for s3fs disable_noobj_cache flag
148+
- Skip unmount for 'is not a mountpoint' error
149+
prerelease: ${{ env.IS_LATEST_RELEASE != 'true' }}
55150

56-
- name: Latest Version (Tag and Release)
57-
id: release
58-
if: contains(steps.check_commit.outputs.message, 'publish')
59-
uses: softprops/action-gh-release@v2
60-
with:
61-
files: |
62-
/home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.deb.tar.gz
63-
/home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.deb.tar.gz.sha256
64-
/home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.rpm.tar.gz
65-
/home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.rpm.tar.gz.sha256
66-
tag_name: v1.0.5
67-
name: v1.0.5
68-
body: |
69-
## 🚀 What’s New
70-
- Fix for rclone mount hang issue
71-
prerelease: ${{ env.IS_LATEST_RELEASE != 'true' }}
72-
73-
- name: Perform CodeQL Analysis
74-
uses: github/codeql-action/analyze@v3
151+
- name: Perform CodeQL Analysis
152+
uses: github/codeql-action/analyze@v3

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
# You are encouraged to use static refs such as tags, instead of branch name
1212
#
1313
# Running "pre-commit autoupdate" would automatically updates rev to latest tag
14-
rev: 0.13.1+ibm.62.dss
14+
rev: 0.13.1+ibm.64.dss
1515
hooks:
1616
- id: detect-secrets # pragma: whitelist secret
1717
# Add options for detect-secrets-hook binary. You can run `detect-secrets-hook --help` to list out all possible options.

.secrets.baseline

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "go.sum|^.secrets.baseline$",
44
"lines": null
55
},
6-
"generated_at": "2025-09-05T07:59:11Z",
6+
"generated_at": "2025-12-18T07:17:56Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -126,14 +126,14 @@
126126
{
127127
"hashed_secret": "a1f0e99af8b76b514ef9e6a174e9c79970332082",
128128
"is_verified": false,
129-
"line_number": 174,
129+
"line_number": 176,
130130
"type": "Secret Keyword",
131131
"verified_result": null
132132
},
133133
{
134134
"hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f",
135135
"is_verified": false,
136-
"line_number": 177,
136+
"line_number": 179,
137137
"type": "Secret Keyword",
138138
"verified_result": null
139139
},
@@ -172,7 +172,7 @@
172172
{
173173
"hashed_secret": "7e6a3680012346b94b54731e13d8a9ffa3790645",
174174
"is_verified": false,
175-
"line_number": 239,
175+
"line_number": 248,
176176
"type": "Secret Keyword",
177177
"verified_result": null
178178
}
@@ -227,7 +227,7 @@
227227
{
228228
"hashed_secret": "2e7a7ee14caebf378fc32d6cf6f557f347c96773",
229229
"is_verified": false,
230-
"line_number": 31,
230+
"line_number": 45,
231231
"type": "Secret Keyword",
232232
"verified_result": null
233233
}
@@ -294,7 +294,7 @@
294294
}
295295
]
296296
},
297-
"version": "0.13.1+ibm.62.dss",
297+
"version": "0.13.1+ibm.64.dss",
298298
"word_list": {
299299
"file": null,
300300
"hash": null

.travis.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ RUN yum update -y && yum install fuse fuse-libs fuse3 fuse3-libs -y
6464
COPY --from=s3fs-builder /usr/local/bin/s3fs /usr/bin/s3fs
6565
COPY --from=rclone-builder /usr/local/bin/rclone /usr/bin/rclone
6666
COPY ibm-object-csi-driver ibm-object-csi-driver
67-
ENTRYPOINT ["/ibm-object-csi-driver"]
67+
ENTRYPOINT ["/ibm-object-csi-driver"]

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@ EXE_DRIVER_NAME=ibm-object-csi-driver
33

44
REGISTRY=quay.io/ibm-object-csi-driver
55

6-
export LINT_VERSION="2.3.1"
6+
export LINT_VERSION="2.7.2"
77

88
COLOR_YELLOW=\033[0;33m
99
COLOR_RESET=\033[0m
1010
GOFILES=$(shell find . -type f -name '*.go' -not -path "./vendor/*")
1111

12-
1312
all: build
1413

15-
1614
.PHONY: build-% clean
1715

1816
REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
@@ -33,9 +31,10 @@ test:
3331

3432
.PHONY: deps
3533
deps:
36-
echo "Installing dependencies ..."
34+
@echo "Installing dependencies ..."
3735
@if ! which golangci-lint >/dev/null || [[ "$$(golangci-lint --version)" != *${LINT_VERSION}* ]]; then \
38-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v${LINT_VERSION}; \
36+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \
37+
sh -s -- -b $(shell go env GOPATH)/bin v${LINT_VERSION}; \
3938
fi
4039

4140
.PHONY: fmt
@@ -44,9 +43,10 @@ fmt: lint
4443

4544
.PHONY: coverage
4645
coverage: test
47-
cat coverage.out | grep -v /fake > cover.out;
48-
# go tool cover -html=cover.out -o=cover.html
49-
go tool cover -func=cover.out | fgrep total
46+
cat coverage.out | grep -v /fake > cover.out
47+
go tool cover -html=cover.out -o cover.html
48+
@echo "Coverage report: cover.html"
49+
@./scripts/calculateCoverage.sh
5050

5151
clean:
5252
-rm -rf bin

cos-csi-mounter/Makefile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ RPM_ARCH := x86_64
1818
RPM_RELEASE_NUM := 1
1919
REDHAT_SPEC := $(BUILD_DIR)/red-hat.spec
2020

21-
test:
22-
go test -v -timeout 1800s -coverprofile=cover.out ./...
23-
go tool cover -html=cover.out -o=cover.html
24-
25-
ut-coverage: test
26-
@./scripts/coverage.sh
27-
rm cover.html cover.out
28-
2921
build-linux:
3022
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod mod -o ${BIN_DIR}/cos-csi-mounter-server -ldflags "-s -w -X main.Version=$(APP_VERSION) -X main.GitCommit=$$(git rev-parse HEAD)" -a ./server
3123
./${BIN_DIR}/cos-csi-mounter-server version

0 commit comments

Comments
 (0)