Skip to content

Commit

Permalink
GitHub workflows (#44)
Browse files Browse the repository at this point in the history
* Removal of test files to be replaced with new files

* Removed Jenkins file, updated Dockerfile and configs directory

* Added github workflows ct smoke tests

* Update to makefile

* update runCT.sh file permission

* Update to unit-test Dockerfile

* Added Integration Tests

* Update arti.dev.cray links missed.

* Changed permissions

* Update to docker paths - misc updates

* Changed error level back

* Version to 1.11.0
  • Loading branch information
mbuchmann-hpe authored May 18, 2022
1 parent c95fe47 commit 477cada
Show file tree
Hide file tree
Showing 62 changed files with 579 additions and 344 deletions.
50 changes: 50 additions & 0 deletions .github/build-image-comment-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!-- This file is templated with https://pkg.go.dev/html/template -->
👋 Hey! Here is the image we built for you ([Artifactory Link](https://artifactory.algol60.net/ui/repos/tree/General/csm-docker%2F{{ .stableString }}%2F{{ .imageName }}%2F{{ .imageTag }})):

```bash
{{ .image }}
```

Use podman or docker to pull it down and inspect locally:

```bash
podman pull {{ .image }}
```

Or, use this script to pull the image from the build server to a dev system:

<details>
<summary>Dev System Pull Script</summary>
<br />

> **Note** the following script only applies to systems running CSM 1.2 or later.
```bash
#!/usr/bin/env bash
export REMOTE_IMAGE={{ .image }}
export LOCAL_IMAGE={{ .imageName }}:{{ .imageTag }}

skopeo copy --dest-tls-verify=false docker://${REMOTE_IMAGE} docker://registry.local/csm-docker/stable/${LOCAL_IMAGE}
```
</details>

<details>
<summary>Snyk Report</summary>
<br />

_Coming soon_

</details>

<details>
<summary>Software Bill of Materials</summary>
<br />

```bash
cosign download sbom {{ .image }} > container_image.spdx
```

If you don't have cosign, then you can get it [here](https://github.com/sigstore/cosign#installation).
</details>

*Note*: this SHA is the merge of {{ .PRHeadSha }} and the PR base branch. Good luck and make rocket go now! 🌮 🚀
20 changes: 20 additions & 0 deletions .github/workflows/build_and_release_ct_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build and Publish CT Docker Images
on:
- push # Perform a build of the contents from the branch
- pull_request # Perform a build after merging with the target branch
- workflow_dispatch
jobs:
build_and_release:
uses: Cray-HPE/hms-build-image-workflows/.github/workflows/build_and_release_image.yaml@v1
with:
image-name: cray-scsd-test
docker-build-file: test/ct/Dockerfile #the tests/ct/Dockerfile is what we want!
docker-build-context: test/ct
enable-pr-comment: true
secrets:
artifactory-username: ${{ secrets.ARTIFACTORY_ALGOL60_USERNAME }}
artifactory-token: ${{ secrets.ARTIFACTORY_ALGOL60_TOKEN }}
snyk-token: ${{ secrets.SNYK_TOKEN }}
cosign-gcp-project-id: ${{ secrets.COSIGN_GCP_PROJECT_ID }}
cosign-gcp-sa-key: ${{ secrets.COSIGN_GCP_SA_KEY }}
cosign-key: ${{ secrets.COSIGN_KEY }}
18 changes: 18 additions & 0 deletions .github/workflows/build_and_release_image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build and Publish Service Docker Images
on:
- push # Perform a build of the contents from the branch
- pull_request # Perform a build after merging with the target branch
- workflow_dispatch
jobs:
build_and_release:
uses: Cray-HPE/hms-build-image-workflows/.github/workflows/build_and_release_image.yaml@v1
with:
image-name: cray-scsd
enable-pr-comment: true
secrets:
artifactory-username: ${{ secrets.ARTIFACTORY_ALGOL60_USERNAME }}
artifactory-token: ${{ secrets.ARTIFACTORY_ALGOL60_TOKEN }}
snyk-token: ${{ secrets.SNYK_TOKEN }}
cosign-gcp-project-id: ${{ secrets.COSIGN_GCP_PROJECT_ID }}
cosign-gcp-sa-key: ${{ secrets.COSIGN_GCP_SA_KEY }}
cosign-key: ${{ secrets.COSIGN_KEY }}
7 changes: 7 additions & 0 deletions .github/workflows/run_ct_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Run CT Tests
on: [push, pull_request, workflow_dispatch]
jobs:
run_ct_test:
uses: Cray-HPE/hms-build-image-workflows/.github/workflows/run_ct_test.yaml@v1
with:
runs-on: ubuntu-latest
7 changes: 7 additions & 0 deletions .github/workflows/run_integration_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Run Integration Tests
on: [push, pull_request, workflow_dispatch]
jobs:
run_integration_test:
uses: Cray-HPE/hms-build-image-workflows/.github/workflows/run_integration_test.yaml@v1
with:
runs-on: ubuntu-latest
7 changes: 7 additions & 0 deletions .github/workflows/run_unit_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Run Unit Tests
on: [push, pull_request, workflow_dispatch]
jobs:
run_unit_test:
uses: Cray-HPE/hms-build-image-workflows/.github/workflows/run_unit_test.yaml@v1
with:
runs-on: ubuntu-latest
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ kubernetes/.packaged/
kubernetes/cray-hms-scsd/charts/

# runIntegration.sh creates the following soft links to the real files under Test/
Dockerfile.fake-hsm
Dockerfile.fake-rfep
Dockerfile.fake-vault
Dockerfile.scsd_functest
Dockerfile.testscsd
docker-compose-functest.yaml

# runIntegration.sh generates these log files
scsdtest_scsd_*.logs*
Expand Down
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.0
1.11.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.11.0] - 2022-05-16

### Changed

- Builds with github actions - removed Jenkins builds

## [1.10.0] - 2021-11-16

### Added
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

### Build Base Stage ###

FROM arti.dev.cray.com/baseos-docker-master-local/golang:1.16-alpine3.13 AS build-base
FROM artifactory.algol60.net/docker.io/library/golang:1.16-alpine AS build-base

RUN set -ex \
&& apk -U upgrade \
Expand All @@ -50,11 +50,12 @@ RUN set -ex \

### Final Stage ###

FROM arti.dev.cray.com/baseos-docker-master-local/alpine:3.13
FROM artifactory.algol60.net/csm-docker/stable/docker.io/library/alpine:3.15
LABEL maintainer="Hewlett Packard Enterprise"
STOPSIGNAL SIGTERM
EXPOSE 25309
STOPSIGNAL SIGTERM
COPY configs configs

RUN set -ex \
&& apk -U upgrade \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.testing
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

### Build Base Stage ###
# Build base has the packages installed that we need.
FROM arti.dev.cray.com/baseos-docker-master-local/golang:1.16-alpine3.13 AS build-base
FROM artifactory.algol60.net/docker.io/library/golang:1.16-alpine AS build-base

RUN set -ex \
&& apk -U upgrade \
Expand Down
4 changes: 2 additions & 2 deletions Test/Dockerfile.testscsd → Dockerfile.testscsd
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# Dockerfile for testing HMS SCSD.

FROM arti.dev.cray.com/baseos-docker-master-local/golang:1.16-alpine3.13 AS build-base
FROM artifactory.algol60.net/docker.io/library/golang:1.16-alpine AS build-base

RUN set -ex \
&& apk update \
Expand All @@ -46,7 +46,7 @@ RUN set -ex \

### Final Stage ###

FROM arti.dev.cray.com/baseos-docker-master-local/alpine:3.13
FROM artifactory.algol60.net/csm-docker/stable/docker.io/library/alpine:3.15
LABEL maintainer="Hewlett Packard Enterprise"
STOPSIGNAL SIGTERM
EXPOSE 25309
Expand Down
62 changes: 0 additions & 62 deletions Jenkinsfile.github

This file was deleted.

40 changes: 9 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License
#
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
# (C) Copyright [2021-2022] 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"),
Expand All @@ -14,7 +14,7 @@
#
# 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
# 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
Expand All @@ -24,18 +24,8 @@
NAME ?= cray-scsd
VERSION ?= $(shell cat .version)

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

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

all: image unittest integration test_rpm
all : image unittest integration ct snyk ct_image

image:
docker build ${NO_CACHE} --pull ${DOCKER_ARGS} --tag '${NAME}:${VERSION}' .
Expand All @@ -46,23 +36,11 @@ 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} ./Test/CT ./LICENSE

test_rpm_build_source:
BUILD_METADATA=$(BUILD_METADATA) rpmbuild -ts $(TEST_SOURCE_PATH) --define "_topdir $(TEST_BUILD_DIR)"
snyk:
./runSnyk.sh

test_rpm_build:
BUILD_METADATA=$(BUILD_METADATA) rpmbuild -ba $(TEST_SPEC_FILE) --define "_topdir $(TEST_BUILD_DIR)" --nodeps
ct:
./runCT.sh

clean:
# Remove files generated by runIntegation.sh
rm -f Dockerfile.fake-hsm Dockerfile.fake-rfep Dockerfile.fake-vault Dockerfile.scsd_functest Dockerfile.testscsd docker-compose-functest.yaml
rm -f scsdtest_scsd_*.logs*
ct_image:
docker build --no-cache -f test/ct/Dockerfile test/ct/ --tag hms-scsd-test:${VERSION}
44 changes: 0 additions & 44 deletions Test/CT/test_bmc_redfish_account_service_password.tavern.yaml

This file was deleted.

Loading

0 comments on commit 477cada

Please sign in to comment.