Skip to content

ibm-mas/python-devops

This branch is 8 commits ahead of, 2 commits behind stable.

Folders and files

NameName
Last commit message
Last commit date
Nov 24, 2024
Mar 3, 2025
Jun 27, 2024
Mar 3, 2025
Mar 3, 2025
Oct 18, 2024
Jan 30, 2025
Oct 18, 2024
Feb 28, 2025
Jan 30, 2025
Jun 17, 2024
Nov 24, 2024
Jun 17, 2024
Nov 24, 2024
Jun 17, 2024
Feb 18, 2025

Repository files navigation

mas.devops

Code style: PEP8 Flake8: checked GitHub Actions Workflow Status PyPI - Version PyPI - Python Version PyPI - Downloads

Example

from openshift import dynamic
from kubernetes import config
from kubernetes.client import api_client

from mas.devops.ocp import createNamespace
from mas.devops.tekton import installOpenShiftPipelines, updateTektonDefinitions, launchUpgradePipeline

instanceId = "mymas"
pipelinesNamespace = f"mas-{instanceId}-pipelines"

# Create an OpenShift client
dynClient = dynamic.DynamicClient(
    api_client.ApiClient(configuration=config.load_kube_config())
)

# Install OpenShift Pipelines Operator
installOpenShiftPipelines(dynamicClient)

# Create the pipelines namespace and install the MAS tekton definitions
createNamespace(dynamicClient, pipelinesNamespace)
updateTektonDefinitions(pipelinesNamespace, "/mascli/templates/ibm-mas-tekton.yaml")

# Launch the upgrade pipeline and print the URL to view the pipeline run
pipelineURL = launchUpgradePipeline(self.dynamicClient, instanceId)
print(pipelineURL)