Skip to content

Conversation

@dev-0pz
Copy link

@dev-0pz dev-0pz commented Oct 21, 2025

Refactored script and changed some inefficiencies with print formatting. Haven't yet tested so going to create dev image to test with, therefore I have left it in this branch for now till I test to merge to main.

https://stfc.atlassian.net/browse/CLDSCRM-2987

From this task, can the reviewer check the code. Review if the logic is right from the description of the task.

needs to be tested still, added the 3 changes from the task
https://stfc.atlassian.net/browse/CLDSCRM-2987
I have coded all these changes and refactors for the task
https://stfc.atlassian.net/browse/CLDSCRM-2987
Has not been tested yet in a dev environment so will test that tomorrow and re get pr if successful.
Comment on lines 40 to 62
with open('/etc/packer-utils/templates/rally-test.json') as templatejson:
testtemplate = json.load(templatejson)

testtemplate["VMTasks.boot_runcommand_delete"][0]["args"]["image"]["name"] = next_image_name

with open("/etc/packer-utils/tests/" + next_image_name + ".json", "w") as testFile:
with open(f"/etc/packer-utils/tests/{next_image_name}.json", "w") as testFile:
json.dump(testtemplate, testFile)

mailfilepath = "/tmp/" + next_image_name + "-" + DATE + ".mail"

test = cl("INSTANCENAME=Prod; rally db create ;rally deployment create --name $INSTANCENAME --filename /opt/rally/existing.json ;rally deployment check $INSTANCENAME ; /opt/rally/bin/rally deployment use Prod ; /opt/rally/bin/rally task start /etc/packer-utils/tests/" + next_image_name + ".json | grep \"rally task report\" | grep \"json\" | sed 's/output.json/\/tmp\/" + next_image_name + "-" + DATE + "\.json/g'")
test = cl(f"INSTANCENAME=Prod; rally db create ;rally deployment create --name $INSTANCENAME --filename /opt/rally/existing.json ;rally deployment check $INSTANCENAME ; /opt/rally/bin/rally deployment use Prod ; /opt/rally/bin/rally task start /etc/packer-utils/tests/{next_image_name}.json | grep \"rally task report\" | grep \"json\" | sed 's/output.json/\/tmp\/{next_image_name}-{DATE}\.json/g'")
print(test)
reportcmd = test.split("\\n\\t")[3].replace("\\n", "").replace("'", "").replace('"','')
print(reportcmd)
print("GENERATING NEW REPORT", flush=True)
#rint(test + " /tmp/"+next_image_name+"-"+DATE+".json")
#cl(test + " /tmp/"+next_image_name+"-"+DATE+".json")

cl(reportcmd)

with open("/tmp/" + next_image_name + "-" + DATE + ".json") as testresultjson:
with open(f"/tmp/{next_image_name}-{DATE}.json") as testresultjson:
testresult = json.load(testresultjson)

testPassed = testresult["tasks"][0]["pass_sla"]

if testPassed:
print(next_image_name)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove everything to do with rally. We will not use Rally to test the images as it is not very useful and we are making our own QA workflow

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When was that decision made? Do you have a draft of the tempest workflow?


next_image_name = sys.argv[1]

current_image_name = next_image_name.replace("Next-", "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

images are no longer called "Next-" instead it is "-baseline"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants