chagu-demo / devops_ai /deployment_script.py
talexm
update
ae2a953
import os
import json
from openai import OpenAI
def generate_helm_chart():
client = OpenAI(
base_url="https://api.studio.nebius.ai/v1/",
api_key="N_KEY"
)
prompt = """
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building...'
sh './gradlew build'
}
}
stage('Test') {
steps {
echo 'Testing...'
sh './gradlew test'
}
}
stage('Deploy') {
steps {
echo 'Deploying...'
sh './deploy.sh'
}
}
}
}
"""
response = client.chat.completions.create(
model="Qwen/Qwen2-VL-72B-Instruct",
messages=[
{
"role": "user",
"content": [
{"type": "text",
"text": f"Convert this Jenkinsfile into a GitHub Actions workflow:\n\n{prompt}"}
],
}
],
max_tokens=300,
)
# Extracting and prettifying the content
if response.choices:
helm_chart_raw = response.choices[0].message.content
# Prettifying the output
print("\n--- Helm Chart Output (Prettified) ---\n")
print(helm_chart_raw.strip())
else:
print("No response received from the API.")
if __name__ == "__main__":
generate_helm_chart()