Skip to content

Commit

Permalink
Merge pull request #35 from Cray-HPE/CASMHMS-5055/break-out-hms-ct-te…
Browse files Browse the repository at this point in the history
…sts-into-separate-rpms-csm-1.2

CASMHMS-5055 Break out HMS CT tests into separate RPMs csm-1.2
  • Loading branch information
schooler-hpe authored Oct 28, 2021
2 parents 3c597bf + b639bf1 commit ab3f14e
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.9.11
1.10.0
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.10.0] - 2021-10-27

### Added

- CASMHMS-5055 - Added BSS CT test RPM.

## [1.9.11] - 2021-09-21

### Changed
Expand Down
13 changes: 13 additions & 0 deletions Jenkinsfile.github
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ pipeline {
NO_CACHE = "--no-cache"
CHART_NAME = "cray-hms-bss"
CHART_VERSION = getChartVersion(version: env.VERSION)
TEST_NAME = "hms-bss-ct-test"
TEST_SPEC_FILE = "hms-bss-ct-test.spec"
BUILD_METADATA = getRpmRevision(isStable: env.IS_STABLE)
}

stages {
Expand All @@ -41,11 +44,21 @@ pipeline {
}
}

stage("Test Rpm") {
steps {
echo "RPM build metadata is: ${env.BUILD_METADATA}"
runLibraryScript("addRpmMetaData.sh", env.TEST_SPEC_FILE)
sh "make test_rpm"
}
}

stage("Publish") {
steps {
script {
publishCsmDockerImage(image: env.NAME, tag: env.VERSION, isStable: env.IS_STABLE)
publishCsmHelmCharts(component: env.CHART_NAME, chartsPath: "${WORKSPACE}/kubernetes/.packaged", isStable: env.IS_STABLE)
publishCsmRpms(component: env.TEST_NAME, pattern: "dist/bss-ct-test-rpmbuild/RPMS/x86_64/*.rpm", arch: "x86_64", isStable: env.IS_STABLE)
publishCsmRpms(component: env.TEST_NAME, pattern: "dist/bss-ct-test-rpmbuild/SRPMS/*.rpm", arch: "src", isStable: env.IS_STABLE)
}
}
}
Expand Down
31 changes: 30 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# MIT License
#
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
Expand All @@ -18,6 +20,7 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

# Service
NAME ?= cray-bss
VERSION ?= $(shell cat .version)

Expand All @@ -26,7 +29,18 @@ CHART_PATH ?= kubernetes
CHART_NAME ?= cray-hms-bss
CHART_VERSION ?= $(shell cat .version)

all : image unittest chart
# Common RPM variable
BUILD_METADATA ?= "1~development~$(shell git rev-parse --short HEAD)"

# CT Test RPM
TEST_SPEC_NAME ?= hms-bss-ct-test
TEST_RPM_VERSION ?= $(shell cat .version)
TEST_SPEC_FILE ?= ${TEST_SPEC_NAME}.spec
TEST_SOURCE_NAME ?= ${TEST_SPEC_NAME}-${TEST_RPM_VERSION}
TEST_BUILD_DIR ?= $(PWD)/dist/bss-ct-test-rpmbuild
TEST_SOURCE_PATH := ${TEST_BUILD_DIR}/SOURCES/${TEST_SOURCE_NAME}.tar.bz2

all : image unittest chart test_rpm

image:
docker build ${NO_CACHE} --pull ${DOCKER_ARGS} --tag '${NAME}:${VERSION}' .
Expand All @@ -39,3 +53,18 @@ chart:
helm dep up ${CHART_PATH}/${CHART_NAME}
helm package ${CHART_PATH}/${CHART_NAME} -d ${CHART_PATH}/.packaged --version ${CHART_VERSION}

test_rpm: test_rpm_prepare test_rpm_package_source test_rpm_build_source test_rpm_build

test_rpm_prepare:
rm -rf $(TEST_BUILD_DIR)
mkdir -p $(TEST_BUILD_DIR)/SPECS $(TEST_BUILD_DIR)/SOURCES
cp $(TEST_SPEC_FILE) $(TEST_BUILD_DIR)/SPECS/

test_rpm_package_source:
tar --transform 'flags=r;s,^,/$(TEST_SOURCE_NAME)/,' --exclude .git --exclude dist -cvjf $(TEST_SOURCE_PATH) ./${TEST_SPEC_FILE} ./tests/ct ./LICENSE

test_rpm_build_source:
BUILD_METADATA=$(BUILD_METADATA) rpmbuild -ts $(TEST_SOURCE_PATH) --define "_topdir $(TEST_BUILD_DIR)"

test_rpm_build:
BUILD_METADATA=$(BUILD_METADATA) rpmbuild -ba $(TEST_SPEC_FILE) --define "_topdir $(TEST_BUILD_DIR)" --nodeps
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ images.
This code will be refactored from the old hms-netboot code for bootargsd and associated components created for the Q4 Redfish and Q1
systems management deep dive demos.

### BSS CT Testing

This repository builds and publishes hms-bss-ct-test RPMs along with the service itself containing tests that verify BSS on the
NCNs of live Shasta systems. The tests require the hms-ct-test-base RPM to also be installed on the NCNs in order to execute.
The version of the test RPM installed on the NCNs should always match the version of BSS deployed on the system.
76 changes: 76 additions & 0 deletions hms-bss-ct-test.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# MIT License
#
# (C) Copyright [2021] Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

Name: hms-bss-ct-test
License: MIT
Summary: HMS CT tests for the Boot Script Service (BSS)
Group: System/Management
Version: %(cat .version)
Release: %(echo ${BUILD_METADATA})
Source: %{name}-%{version}.tar.bz2
Vendor: Hewlett Packard Enterprise
Requires: hms-ct-test-base >= 1.9.0

# name of this repository
%define REPO hms-bss

# test installation location
%define TEST_DIR /opt/cray/tests

%description
This is a collection of post-install CT tests for BSS.

%prep
%setup -q

%build
# Categories of CT tests to install
TEST_BUCKETS=(
ncn-smoke
ncn-functional
ncn-long
ncn-destructive
ncn-resources
remote-smoke
remote-functional
remote-long
remote-destructive
remote-resources
)

echo "Current directory is: ${PWD}..."

echo "Searching for CT tests..."
for BUCKET in ${TEST_BUCKETS[@]} ; do
find . -name "*${BUCKET}*" -exec mkdir -p %{buildroot}%{TEST_DIR}/${BUCKET}/hms/%{REPO}/ \; \
-exec cp -v {} %{buildroot}%{TEST_DIR}/${BUCKET}/hms/%{REPO}/ \;
done

%files

# CT tests
%dir %{TEST_DIR}
%{TEST_DIR}/*

%changelog
* Wed Oct 27 2021 Mitch Schooler <[email protected]>
- Moved CT test packaging from hms-test to individual service repos for their own RPM builds.
2 changes: 1 addition & 1 deletion kubernetes/cray-hms-bss/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
description: "Kubernetes resources for cray-hms-bss"
name: "cray-hms-bss"
home: "HMS/hms-bss"
version: 1.9.11
version: 1.10.0

0 comments on commit ab3f14e

Please sign in to comment.