Skip to content

Commit

Permalink
Merge pull request #48 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 b417002 + f028f2e commit eb1289a
Show file tree
Hide file tree
Showing 7 changed files with 154 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.27.0
1.28.0
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Fixed - for any bug fixes
Security - in case of vulnerabilities
-->

## [1.28.0] - 2021-10-27

### Added

- CASMHMS-5055 - Added CAPMC CT test RPM.

## [1.27.0] - 2021-10-21

### Added
Expand Down
15 changes: 14 additions & 1 deletion 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-capmc"
CHART_VERSION = getChartVersion(version: env.VERSION)
TEST_NAME = "hms-capmc-ct-test"
TEST_SPEC_FILE = "hms-capmc-ct-test.spec"
BUILD_METADATA = getRpmRevision(isStable: env.IS_STABLE)
}

stages {
Expand Down Expand Up @@ -47,11 +50,21 @@ pipeline {
}
}

stage('Publish ') {
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/capmc-ct-test-rpmbuild/RPMS/x86_64/*.rpm", arch: "x86_64", isStable: env.IS_STABLE)
publishCsmRpms(component: env.TEST_NAME, pattern: "dist/capmc-ct-test-rpmbuild/SRPMS/*.rpm", arch: "src", isStable: env.IS_STABLE)
}
}
}
Expand Down
51 changes: 50 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# 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.

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

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

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

# CT Test RPM
TEST_SPEC_NAME ?= hms-capmc-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/capmc-ct-test-rpmbuild
TEST_SOURCE_PATH := ${TEST_BUILD_DIR}/SOURCES/${TEST_SOURCE_NAME}.tar.bz2

all : image chart unittest integration test_rpm

image:
docker build ${NO_CACHE} --pull ${DOCKER_ARGS} --tag '${NAME}:${VERSION}' .
Expand All @@ -22,3 +56,18 @@ unittest:
integration:
./runIntegration.sh

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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ cray capmc xname_off create --xnames x1000c0 --recursive

On target system, delete the running pod and the one pushed will get started.

## CAPMC CT Testing

This repository builds and publishes hms-capmc-ct-test RPMs along with the service itself containing tests that verify CAPMC 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 CAPMC deployed on the system.

## API Map

When the different APIs will be supported:
Expand Down
76 changes: 76 additions & 0 deletions hms-capmc-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-capmc-ct-test
License: MIT
Summary: HMS CT tests for the Cray Advanced Platform Monitoring and Control service (CAPMC)
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-capmc

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

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

%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-capmc/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ apiVersion: v1
description: "Kubernetes resources for cray-hms-capmc"
name: "cray-hms-capmc"
home: "HMS/hms-capmc"
version: 1.27.0
version: 1.28.0

0 comments on commit eb1289a

Please sign in to comment.