Skip to content

Commit

Permalink
Merge pull request #365 from Cray-HPE/casmtriage-7413
Browse files Browse the repository at this point in the history
CASMTRIAGE-7413: Split Python source + YAML schemas to new repo
  • Loading branch information
mharding-hpe authored Oct 21, 2024
2 parents 5f4a2f8 + 6b6a2a5 commit d1cfd12
Show file tree
Hide file tree
Showing 45 changed files with 39 additions and 5,425 deletions.
26 changes: 1 addition & 25 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# MIT License
#
# (C) Copyright 2022-2023 Hewlett Packard Enterprise Development LP
# (C) Copyright 2022-2024 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 Down Expand Up @@ -35,30 +35,6 @@ updates:
- "dependabot"
open-pull-requests-limit: 16

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
assignees:
- "Cray-HPE/CMS-core-product-support"
labels:
- "python-deps"
- "dependabot"
open-pull-requests-limit: 16
allow:
# Allow updates to both direct and indirect dependencies
- dependency-type: "all"
ignore:
# Currently there is a limitation we don't want dependabot to keep tripping over. Namely:
# kubernetes 26.1.0 depends on urllib3>=1.24.2
# google-auth 2.21.0 depends on urllib3<2.0
# So we cap urllib3 to be <2.0
- dependency-name: "urllib3"
versions: [ ">=2.0.0" ]
# Only look for patch version updates
- dependency-name: "*"
update-types: ["version-update:semver-major", "version-update:semver-minor" ]

- package-ecosystem: "docker"
directory: "/"
schedule:
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Removed
- CASMTRIAGE-7413: Remove all Python content and YAML schemas. This has been moved to the
`cray-product-catalog-core` repository.

### Changed
- CASMTRIAGE-7413: Instead of building the cray-product-catalog Python module in the [Dockerfile](Dockerfile),
instead install the module build from the `cray-product-catalog-core` repository.

### Dependencies
- Bump version of `certifi` to resolve CVE.

## [2.4.1] - 2024-09-19

### Changed
Expand Down
20 changes: 9 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,30 @@
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
FROM artifactory.algol60.net/csm-docker/stable/docker.io/library/alpine:3.15 as base
RUN apk add --no-cache py3-pip python3

FROM artifactory.algol60.net/csm-docker/stable/docker.io/library/alpine:3.15 AS base
WORKDIR /src/
COPY cray_product_catalog/ ./cray_product_catalog
COPY setup.py requirements.txt constraints.txt README.md MANIFEST.in ./
COPY requirements.txt constraints.txt README.md ./

RUN apk add --upgrade --no-cache apk-tools \
RUN --mount=type=secret,id=netrc,target=/root/.netrc \
apk add --upgrade --no-cache apk-tools \
&& apk update \
&& apk add --update --no-cache \
gcc \
python3-dev \
libc-dev \
py3-pip \
python3 \
python3-dev \
&& apk -U upgrade --no-cache \
&& pip3 install --no-cache-dir --upgrade pip wheel -c constraints.txt \
&& pip3 install --ignore-installed --no-cache-dir -r requirements.txt \
&& python3 setup.py install \
&& pip3 list --format freeze \
&& rm -rf /src/

&& ln -s /usr/bin/catalog_update /catalog_update.py
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# Must make catalog_update available as /catalog_update.py
# because it is currently specified this way in the cray-import-config helm
# chart. This is not easy to do with setuptools directly, so just link it
# here.
# https://github.com/Cray-HPE/cray-product-install-charts/blob/master/charts/cray-import-config/templates/job.yaml#L50
RUN ln -s /usr/bin/catalog_update /catalog_update.py

WORKDIR /
USER nobody:nobody
Expand Down
32 changes: 4 additions & 28 deletions Jenkinsfile.github
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
@Library('cms-meta-tools') _
@Library('csm-shared-library') __

def pyImage = 'artifactory.algol60.net/csm-docker/stable/csm-docker-sle-python'

pipeline {
agent {
label "metal-gcp-builder"
Expand All @@ -43,7 +41,6 @@ pipeline {

environment {
NAME = "cray-product-catalog"
PYMOD_NAME = "cray-product-catalog"
DESCRIPTION = "Update a product catalog with product/version artifacts."
APP_NAME = "cray-product-catalog-update"
IS_STABLE = getBuildIsStable()
Expand Down Expand Up @@ -79,47 +76,27 @@ pipeline {
sh "make lint"
}
}

stage("Build") {
environment {
DOCKER_VERSION = sh(returnStdout: true, script: "head -1 .docker_version").trim()
}
parallel {
stage('Image') {
environment {
DOCKER_VERSION = sh(returnStdout: true, script: "head -1 .docker_version").trim()
DOCKER_ARGS = getDockerBuildArgs(name: env.NAME, description: env.DESCRIPTION, version: env.DOCKER_VERSION)
}

steps {
echo "Docker args are ${env.DOCKER_ARGS}"
sh "make image"
}
}

stage('Chart') {
environment {
DOCKER_VERSION = sh(returnStdout: true, script: "head -1 .docker_version").trim()
}

steps {
updateCsmHelmChartAppVersion(chartPath: "${WORKSPACE}/charts/${NAME}", appVersion: env.DOCKER_VERSION)
sh "make chart"
}
}

stage('Python Package'){
agent {
docker {
args "-v /home/jenkins/.ssh:/home/jenkins/.ssh -v /home/jenkins/.netrc:/home/jenkins/.netrc"
reuseNode true
image "${pyImage}:3.10"
}
}
steps {
sh "make pymod_prepare"
sh "make pymod_build"
sh "make pymod_test"
}
}

}
}

Expand All @@ -131,7 +108,6 @@ pipeline {
steps {
publishCsmDockerImage(image: env.APP_NAME, tag: env.DOCKER_VERSION, isStable: env.IS_STABLE)
publishCsmHelmCharts(component: env.NAME, chartsPath: "${WORKSPACE}/charts/.packaged", isStable: env.IS_STABLE)
publishCsmPythonModules(module: env.PYMOD_NAME, isStable: env.IS_STABLE)
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

17 changes: 0 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ HELM_UNITTEST_IMAGE ?= quintush/helm-unittest:3.3.0-0.2.5

all: runbuildprep lint image chart pymod
chart: chart_setup chart_package chart_test
pymod: pymod_prepare pymod_build pymod_test

runbuildprep:
./cms_meta_tools/scripts/runBuildPrep.sh
Expand All @@ -58,19 +57,3 @@ chart_package:
chart_test:
helm lint "${CHART_PATH}/${NAME}"
docker run --rm -v ${PWD}/${CHART_PATH}:/apps ${HELM_UNITTEST_IMAGE} -3 ${NAME}

pymod_prepare:
pip3 install --upgrade --user pip setuptools wheel

pymod_build:
python3 setup.py sdist bdist_wheel

pymod_test:
pip3 install --user -r requirements.txt
pip3 install --user -r requirements-test.txt
mkdir -p pymod_test
python3 setup.py install --user
python3 -m unittest discover tests
python3 -m pycodestyle --config=.pycodestyle cray_product_catalog tests
# Run pylint, but only fail the build if the code scores lower than 8.0
python3 -m pylint --fail-under=8.0 --rcfile=.pylintrc cray_product_catalog tests
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Cray Product Catalog

This repository contains the Docker image definition for the cray-product-catalog-update
image. This image provides a script that uploads the contents of a yaml file to
a product catalog entry, which serves as a kubernetes config map.
This repository contains the Docker image definition for the cray-product-catalog-update image. This
image provides a script that uploads the contents of a yaml file to a product catalog entry, which serves
as a kubernetes config map. All of the Python source code and YAML schemas have been moved to the
[`cray-product-catalog-core`](https://github.com/Cray-HPE/cray-product-catalog-core) repository.
See the [`README` file](https://github.com/Cray-HPE/cray-product-catalog-core/blob/develop/README.md)
in that repository for additional details about the product catalog.

See the [CSM Compatibility Matrix](https://github.com/Cray-HPE/cray-product-catalog/wiki/CSM-Compatibility-Matrix)
for more information about what version of the Cray Product Catalog Update image to
Expand Down Expand Up @@ -164,12 +167,6 @@ output is governed by the `GitVersion.yml` file in the root of this repo.
Run `gitversion -output json` to see the current version based on the checked
out commit.

Create a release by triggering the [Draft New Release](https://github.com/Cray-HPE/cray-product-catalog/actions/workflows/draft-new-release.yml)
workflow with the version that will be released.

Releases are automatically published when pull requests to the master branch
are merged.

## Contributing

This repo uses [Git Flow](https://nvie.com/posts/a-successful-git-branching-model/)
Expand All @@ -181,8 +178,6 @@ CMS-core-product-support team members should make a branch. Others, make a fork.

* Alpine Linux
* Python 3
* Python Requests
* Kubernetes Python Client
* Docker
* [Git Flow](https://nvie.com/posts/a-successful-git-branching-model/)
* [Gitversion](https://gitversion.net)
Expand All @@ -194,6 +189,7 @@ See the [CHANGELOG](CHANGELOG.md) for changes. This file uses the [Keep A Change
format.

## Copyright and License

This project is copyrighted by Hewlett Packard Enterprise Development LP and is under the MIT
license. See the [LICENSE](LICENSE) file for details.

5 changes: 2 additions & 3 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
attrs>=23.1,<23.2
cachetools>=5.3.3,<5.4
certifi==2023.5.7
certifi==2023.7.22
charset-normalizer>=3.2.0,<3.3
cray-product-catalog>=2.5,<2.6
google-auth>=2.22,<2.23
idna>=3.4,<3.5
jsonschema>=4.18.6,<4.19
# CSM 1.6 moved to Kubernetes 1.24, so use client v24.x to ensure compatability
kubernetes>=24.2,<24.3
oauthlib>=3.2.2,<3.3
pip>=23.2.1,<23.3
pyasn1>=0.5.1,<0.6
pyasn1-modules>=0.3,<0.4
pyrsistent>=0.19.3,<0.20
Expand All @@ -17,7 +17,6 @@ PyYAML>=6.0.1,<6.1
requests>=2.31,<2.32
requests-oauthlib>=1.3.1,<1.4
rsa>=4.9,<4.10
setuptools>=68.0,<68.1
six>=1.16,<1.17
urllib3>=1.26.19,<1.27
websocket-client>=1.6.4,<1.7
Expand Down
23 changes: 0 additions & 23 deletions cray_product_catalog/__init__.py

This file was deleted.

Loading

0 comments on commit d1cfd12

Please sign in to comment.