Skip to content

Commit

Permalink
Add mount-helper-container req. to workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Prankul <[email protected]>
  • Loading branch information
prankulmahajan authored and anand-desai committed Mar 19, 2024
1 parent a325c8b commit d54f679
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 25 deletions.
46 changes: 38 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- workflow

jobs:
release:
Expand All @@ -14,52 +15,81 @@ jobs:
matrix:
package_dir:
- mount-helper
- mount-helper-container

steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Install Strongswan For Testing IPSec Service In Unit Tests
if: ${{ matrix.package_dir == 'mount-helper' }}
run: sudo apt install charon-systemd

- name: Run Unit Tests
- name: Run Unit Tests for mount helper
if: ${{ matrix.package_dir == 'mount-helper' }}
run: sudo make test -C ${{ matrix.package_dir }}


- name: Run Unit Tests for mount helper container
if: ${{ matrix.package_dir == 'mount-helper-container' }}
run: sudo make ut-coverage -C ${{ matrix.package_dir }}

- name: Build Debian/rpm Packages For Development Environment
if: ${{ matrix.package_dir == 'mount-helper' }}
run: make dev -C ${{ matrix.package_dir }}

- name: Build Debian/rpm Packages For mount-helper-container
if: ${{ matrix.package_dir == 'mount-helper-container' }}
run: |
cd ${{ matrix.package_dir }}
make packages
- name: Development Environment Latest Version
if: ${{ matrix.package_dir == 'mount-helper' }}
id: dev-release
uses: softprops/action-gh-release@v1
with:
files: /home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/mount-helper/mount.ibmshare-latest.tar.gz,/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/mount-helper/mount.ibmshare-latest.tar.gz.sha256
files: /home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/${{ matrix.package_dir }}/mount.ibmshare-latest.tar.gz,/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/${{ matrix.package_dir }}/mount.ibmshare-latest.tar.gz.sha256
tag_name: dev-pre-ga
name: Development Version
body: Mount Helper For Development Teams-GA

- name: Build Debian/rpm Packages For Production Environment
run: make prod -C ${{ matrix.package_dir }}
if: ${{ matrix.package_dir == 'mount-helper' }}
run: |
make prod -C ${{ matrix.package_dir }}
cd mount-helper-container
make packages
- name: Latest Tag Release
id: latest-tag
uses: softprops/action-gh-release@v1
with:
files: /home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/mount-helper/mount.ibmshare-latest.tar.gz, /home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/mount-helper/mount.ibmshare-latest.tar.gz.sha256
files: |
/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/${{ matrix.package_dir }}/mount.ibmshare-latest.tar.gz
/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/${{ matrix.package_dir }}/mount.ibmshare-latest.tar.gz.sha256
/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/mount-helper-container/mount-helper-container-latest.tar.gz
/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/mount-helper-container/mount-helper-container-latest.tar.gz.sha256
tag_name: latest
name: Latest
body: The latest release tag provides static link for package download. This has the same artificats as in the versioned latest version.

- name: Latest Version
if: ${{ matrix.package_dir == 'mount-helper' }}
id: release
uses: softprops/action-gh-release@v1
with:
files: /home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/mount-helper/mount.ibmshare-latest.tar.gz,/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/mount-helper/mount.ibmshare-latest.tar.gz.sha256
tag_name: 0.0.3
name: 0.0.3
files: |
/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/${{ matrix.package_dir }}/mount.ibmshare-latest.tar.gz
/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/${{ matrix.package_dir }}/mount.ibmshare-latest.tar.gz.sha256
/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/mount-helper-container/mount-helper-container-latest.tar.gz
/home/runner/work/vpc-file-storage-mount-helper/vpc-file-storage-mount-helper/mount-helper-container/mount-helper-container-latest.tar.gz.sha256
tag_name: 0.0.4
name: 0.0.4
body: CSR generated with SHA1 is not supported to get certs using Metadata.

- name: Initialize CodeQL
uses: github/codeql-action/init@v2

- name: Perform CodeQL Analysis Mount Helper Code
if: ${{ matrix.package_dir == 'mount-helper' }}
uses: github/codeql-action/analyze@v2
34 changes: 17 additions & 17 deletions mount-helper-container/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ RPM_RELEASE_NUM := 1

BUILD_DIR := $(NAME)-$(APP_VERSION)
BIN_DIR := bin
INSTALL_TAR_FILE := "$(NAME)-latest.tar.gz"
CHECKSUM_FILE := "$(INSTALL_TAR_FILE).sha256"

DEBIAN_CONTROL := $(BUILD_DIR)/DEBIAN/control
REDHAT_SPEC := $(BUILD_DIR)/red-hat.spec
Expand Down Expand Up @@ -100,44 +102,42 @@ rpm-build: build-linux
cp $(BUILD_DIR)/rpm/RPMS/* ./
rm -rf $(BUILD_DIR)

tar-package:
tar-package:
mkdir packages
cp ${NAME}-* packages/
cd packages && tar -czvf ../$(INSTALL_TAR_FILE) *
sha256sum ./$(INSTALL_TAR_FILE) > $(CHECKSUM_FILE)
@printf "Production - Install package created ok: $(INSTALL_TAR_FILE)\n"

packages:
packages: deb-build rpm-build clean
packages: deb-build rpm-build tar-package clean

build:
CGO_ENABLED=0 GOOS=$(go env GOOS) GOARCH=$(go env GOARCH) go build -mod mod -o ${BIN_DIR}/mount-helper-container-server ./server/server.go

build-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod mod -o ${BIN_DIR}/mount-helper-container-server -ldflags "-s -w" -a ./server/server.go

addpackage:
go mod tidy

clean:
rm -rf bin
rm -rf ${BIN_DIR}
rm *.deb *.rpm
rm -rf packages

startservice:
startservice: build-linux
systemctl daemon-reload
cp ./mount-helper-container.service /etc/systemd/system/
cp ./bin/mount-helper-container-server /usr/local/bin/
cp ./${BIN_DIR}/mount-helper-container-server /usr/local/bin/
service mount-helper-container start
systemctl enable mount-helper-container
systemctl start mount-helper-container

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

test:
$(GOPATH)/bin/gotestcover -v -race -short -coverprofile=cover.out ${GOPACKAGES}
go test -v -timeout 1800s -coverprofile=cover.out ./...
go tool cover -html=cover.out -o=cover.html

ut-coverage: deps test
ut-coverage: test
@./scripts/coverage.sh
rm cover.html cover.out
go mod tidy

0 comments on commit d54f679

Please sign in to comment.