Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
32f33ba
travis to githubaction migration
Dec 8, 2025
11f9e32
add coverage scripts
Dec 8, 2025
fbae862
removed travis.yaml
Dec 8, 2025
2f7e66f
canges in makefile
Dec 8, 2025
f1dbe44
minor changes
Dec 8, 2025
c1a197c
minor changes
Dec 8, 2025
8950e30
minor changes
Dec 8, 2025
d4006cd
minor changes
Dec 8, 2025
dbf9075
minor changes
Dec 8, 2025
c972dd1
minor changes
Dec 8, 2025
139464c
minor changes
Dec 8, 2025
b9dd66d
fix: use full ubi8/ubi base (has rpcbind and nfs-utils)
Dec 8, 2025
a52728c
fix: use full ubi8/ubi base (has rpcbind and nfs-utils)
Dec 8, 2025
2564d2e
Fix Dockerfile image tag: ubi8/ubi:8 -> ubi8/ubi:latest
Dec 8, 2025
71f082d
minor changes
Dec 8, 2025
9440dca
minor changes
Dec 8, 2025
5abdfee
minor changes
Dec 8, 2025
90e0600
minor changes
Dec 8, 2025
7996aa9
minor changes
Dec 8, 2025
34541b0
minor changes
Dec 8, 2025
d7b78dd
minor changes
Dec 8, 2025
de0199e
minor changes
Dec 8, 2025
1e7fb30
fixed review comments
Dec 11, 2025
ba30846
minor changes
Dec 11, 2025
05d22f8
minor changes
Dec 11, 2025
5ab469f
minor changes
Dec 14, 2025
73272e6
added common steps
Dec 15, 2025
fd49f5c
minor changes
Dec 15, 2025
2bd7960
minor changes in pipeline
Dec 15, 2025
ec9472f
minor changes
Dec 16, 2025
aae88d3
Revert Dockerfile changes
Dec 16, 2025
830e7d5
Revert Dockerfile changes
Dec 16, 2025
93b3690
Revert Dockerfile changes
Dec 16, 2025
985c013
Revert Dockerfile changes
Dec 16, 2025
fa24c1e
Revert Dockerfile changes
Dec 16, 2025
14beee2
fixed review comments
Dec 16, 2025
2d4c6eb
fixed review comments
Dec 16, 2025
663aa85
minor canges
Dec 16, 2025
5fb9f69
minor canges
Dec 16, 2025
9f01112
minor canges
Dec 16, 2025
ade7ad3
minor canges
Dec 16, 2025
f3cf83e
minor canges
Dec 16, 2025
386f9bf
minor canges
Dec 17, 2025
9388067
changed go version to 1.25.3
Dec 17, 2025
2b2c0d9
minor canges
Dec 17, 2025
406067f
minor canges
Dec 17, 2025
cf5348c
minor canges
Dec 17, 2025
62e5292
minor canges
Dec 17, 2025
06d2fe4
minor canges
Dec 17, 2025
2ac127d
minor canges
Dec 17, 2025
b4c22cd
minor canges
Dec 17, 2025
79d4925
minor canges
Dec 17, 2025
599194b
minor changes
ashimagarg27 Dec 18, 2025
5858c3c
Fix to build debian and rpm pkg (#287)
ashimagarg27 Dec 18, 2025
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
90 changes: 81 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,85 @@
name: Release
name: CI & Release

on:
push:
branches:
- main
- master
tags:
- "v[0-9]+.[0-9]+.[0-9]+*"
pull_request:
branches:
- main
- master

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
contents: write # needed to push coverage to gh-pages
pull-requests: write # needed to comment on PRs

strategy:
matrix:
go-version: ["1.24.5", "stable"]
fail-fast: false

steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
check-latest: true
cache: true

- name: Install system dependencies (bc + docker)
run: |
sudo apt-get update -qq
sudo apt-get install -y bc docker-ce-cli

- name: Make scripts executable
run: chmod +x scripts/*.sh || true

- name: Prepare environment
run: |
export GO111MODULE=on
go mod tidy
make deps

- name: Check code formatting
run: make fmt

- name: Run unit tests
run: make test

- name: Generate coverage
run: |
make coverage
./scripts/calculateCoverage.sh
touch "Passing" || touch "Failed"

- name: Build driver image
run: make driver

- name: Publish coverage
if: success() && matrix.go-version == 'stable' && (github.ref == 'refs/heads/master' || github.event_name == 'pull_request')
env:
GHE_TOKEN: ${{ secrets.GHE_TOKEN }}
run: |
./scripts/publishCoverage.sh

release:
permissions: write-all
needs: build-and-test
permissions: write-all
runs-on: ubuntu-latest

strategy:
Expand All @@ -30,7 +102,7 @@ jobs:
uses: github/codeql-action/init@v3
with:
languages: "go"

- name: Run Unit Tests for cos csi mounter
run: sudo make ut-coverage -C ${{ matrix.package_dir }}

Expand All @@ -41,11 +113,11 @@ jobs:

- name: Get last commit message
id: check_commit
run: |
run: |
message=$(git log -1 --pretty=%B)
message="${message//'%'/'%25'}" # Escape '%'
message="${message//$'\n'/'%0A'}" # Escape newlines
message="${message//$'\r'/'%0D'}" # Escape carriage returns
message="${message//'%'/'%25'}"
message="${message//$'\n'/'%0A'}"
message="${message//$'\r'/'%0D'}"
echo "message=$message" >> "$GITHUB_OUTPUT"
shell: bash

Expand All @@ -66,9 +138,9 @@ jobs:
tag_name: v1.0.5
name: v1.0.5
body: |
## 🚀 Whats New
## What's New
- Fix for rclone mount hang issue
prerelease: ${{ env.IS_LATEST_RELEASE != 'true' }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

63 changes: 39 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.10-1179.1741863533 AS s3fs-builder

ARG RHSM_PASS=blank
ARG RHSM_USER=blank

ENV RHSM_PASS="${RHSM_PASS}"
ENV RHSM_USER="${RHSM_USER}"

ADD register-sys.sh /usr/bin/
RUN microdnf update --setopt=tsflags=nodocs && \
microdnf install -y --nodocs hostname subscription-manager
RUN hostname; chmod 755 /usr/bin/register-sys.sh && /usr/bin/register-sys.sh
RUN microdnf update --setopt=tsflags=nodocs && \
microdnf install -y --nodocs iputils nfs-utils rpcbind xfsprogs udev nc e2fsprogs e4fsprogs && \
microdnf clean all -y
RUN microdnf update --setopt=tsflags=nodocs && \
microdnf install -y gcc libstdc++-devel \
gcc-c++ fuse curl-devel \
libxml2-devel openssl-devel mailcap \
git automake make
RUN microdnf -y install fuse-devel
RUN rm /usr/bin/register-sys.sh && subscription-manager unregister && subscription-manager clean

RUN git clone https://github.com/s3fs-fuse/s3fs-fuse.git && cd s3fs-fuse && \
ARG RHSM_PASS=blank
ARG RHSM_USER=blank
ENV RHSM_PASS="${RHSM_PASS}"
ENV RHSM_USER="${RHSM_USER}"

ADD register-sys.sh /usr/bin/

RUN microdnf update --setopt=tsflags=nodocs && \
microdnf install -y --nodocs hostname subscription-manager findutils xz && \
microdnf clean all -y

RUN echo "Skipping RHSM registration in public CI" && hostname

RUN microdnf update --setopt=tsflags=nodocs && \
microdnf install -y --nodocs iputils nmap-ncat udev findutils && \
microdnf clean all -y

RUN microdnf update --setopt=tsflags=nodocs && \
microdnf install -y gcc libstdc++-devel \
gcc-c++ fuse curl-devel \
libxml2-devel openssl-devel mailcap \
git automake make && \
microdnf clean all -y

RUN microdnf -y install fuse-devel && microdnf clean all -y

RUN rm /usr/bin/register-sys.sh && subscription-manager unregister && subscription-manager clean || true

RUN git clone https://github.com/s3fs-fuse/s3fs-fuse.git && \
cd s3fs-fuse && \
git checkout v1.94 && \
./autogen.sh && ./configure --prefix=/usr/local --with-openssl && make && make install && \
./autogen.sh && ./configure --prefix=/usr/local --with-openssl && \
make && make install && \
rm -rf /var/lib/apt/lists/*


FROM registry.access.redhat.com/ubi8/ubi AS rclone-builder
RUN yum install wget git gcc -y

Expand All @@ -50,6 +60,8 @@ RUN git clone https://github.com/rclone/rclone.git && \
go build && ./rclone version && \
cp rclone /usr/local/bin/rclone

# ---------------------------------------------------------------------------------------

FROM registry.access.redhat.com/ubi8/ubi:latest

# Default values
Expand All @@ -60,7 +72,10 @@ ARG build_date=unknown
LABEL description="IBM CSI Object Storage Plugin"
LABEL build-date=${build_date}
LABEL git-commit-id=${git_commit_id}
RUN yum update -y && yum install fuse fuse-libs fuse3 fuse3-libs -y

RUN yum update -y && \
yum install -y fuse fuse-libs fuse3 fuse3-libs && \
yum clean all -y
COPY --from=s3fs-builder /usr/local/bin/s3fs /usr/bin/s3fs
COPY --from=rclone-builder /usr/local/bin/rclone /usr/bin/rclone
COPY ibm-object-csi-driver ibm-object-csi-driver
Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ EXE_DRIVER_NAME=ibm-object-csi-driver

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

export LINT_VERSION="2.3.1"
export LINT_VERSION="1.64.8"

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


all: build


.PHONY: build-% clean

REV=$(shell git describe --long --tags --match='v*' --dirty 2>/dev/null || git rev-list -n1 HEAD)
Expand All @@ -29,13 +27,14 @@ GOPACKAGES=$(shell go list ./... | grep -v ./tests/... | grep -v /mounter/utils

.PHONY: test
test:
go test -v -race ${GOPACKAGES} -coverprofile=coverage.out
go run github.com/pierrre/gotestcover@latest -v -race -coverprofile=coverage.out ${GOPACKAGES}

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

.PHONY: fmt
Expand All @@ -44,9 +43,10 @@ fmt: lint

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

clean:
-rm -rf bin
Expand Down
43 changes: 37 additions & 6 deletions pkg/mounter/mounter_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
package mounter

import (
"reflect"
"sort"
"testing"

"github.com/IBM/ibm-object-csi-driver/pkg/constants"
mounterUtils "github.com/IBM/ibm-object-csi-driver/pkg/mounter/utils"
"github.com/stretchr/testify/assert"

"reflect"
"testing"
)

func stringSlicesEqualIgnoreOrder(a, b []string) bool {
if len(a) != len(b) {
return false
}
aCopy := make([]string, len(a))
bCopy := make([]string, len(b))
copy(aCopy, a)
copy(bCopy, b)
sort.Strings(aCopy)
sort.Strings(bCopy)
return reflect.DeepEqual(aCopy, bCopy)
}

func TestNewMounter(t *testing.T) {
tests := []struct {
name string
Expand Down Expand Up @@ -41,7 +55,7 @@ func TestNewMounter(t *testing.T) {
AuthType: "iam",
KpRootKeyCrn: "test-kp-root-key-crn",
MountOptions: []string{"opt1=val1", "cipher_suites=default"},
MounterUtils: &(mounterUtils.MounterOptsUtils{}),
MounterUtils: &mounterUtils.MounterOptsUtils{},
},
expectedErr: nil,
},
Expand Down Expand Up @@ -71,7 +85,7 @@ func TestNewMounter(t *testing.T) {
UID: "fake-uid",
GID: "fake-gid",
MountOptions: []string{"opt1=val1", "opt2=val2"},
MounterUtils: &(mounterUtils.MounterOptsUtils{}),
MounterUtils: &mounterUtils.MounterOptsUtils{},
},
expectedErr: nil,
},
Expand All @@ -97,7 +111,7 @@ func TestNewMounter(t *testing.T) {
AuthType: "hmac",
KpRootKeyCrn: "test-kp-root-key-crn",
MountOptions: []string{"cipher_suites=default"},
MounterUtils: &(mounterUtils.MounterOptsUtils{}),
MounterUtils: &mounterUtils.MounterOptsUtils{},
},
expectedErr: nil,
},
Expand All @@ -109,6 +123,23 @@ func TestNewMounter(t *testing.T) {

result := factory.NewMounter(test.attrib, test.secretMap, test.mountOptions, nil)

if s3fs, ok := result.(*S3fsMounter); ok {
expected := test.expected.(*S3fsMounter)
if !stringSlicesEqualIgnoreOrder(s3fs.MountOptions, expected.MountOptions) {
t.Errorf("MountOptions mismatch.\nGot: %v\nWant: %v", s3fs.MountOptions, expected.MountOptions)
}
s3fs.MountOptions = nil
expected.MountOptions = nil
}
if rclone, ok := result.(*RcloneMounter); ok {
expected := test.expected.(*RcloneMounter)
if !stringSlicesEqualIgnoreOrder(rclone.MountOptions, expected.MountOptions) {
t.Errorf("MountOptions mismatch.\nGot: %v\nWant: %v", rclone.MountOptions, expected.MountOptions)
}
rclone.MountOptions = nil
expected.MountOptions = nil
}

assert.Equal(t, result, test.expected)

if !reflect.DeepEqual(result, test.expected) {
Expand Down
Loading
Loading