Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Perforce Python Script Collection.

rajeshkumar created the topic: Perforce Python Script Collection.

Implement a script that will do following:

1. Read config file. This file will contain following settings:
a. For mail delivery (SMTP)
b. For access to perforce server
2. Get from perforce a list of changes made since last script run time and get all updated files
3. Invoke script that will ‘build’ the changes – it will be located in the working folder of the
script(build.bat/build.sh). Script itself should come from perforce as well during step 2.
4. If running of build script is successful, add/update contents of folder named ‘bin’ in the perforce
repository (it is expected that build script will put there a product of its work)
5. In case of error of invocation, send out an email with the list of changes retrieved in p.2 and all outputs of
build script (both stdout/stderr), in which case contents of ‘bin’ folder should not be updated to perforce

Solution
Script details:
master.py – This file is the main file which should be excuted to get the all desired output as per the task
build.bat – This is a Build file which will be executing during compilation phase in master.py. config.ini: Following key should be modified as the environment specification

Sender
Receivers
Message
Host
p4port
p4user
p4client
p4passwd
Scenario to create fail Build:
Remove comment line from “REM mkdir raj” in build.bat

How to use?
Change the config.ini file appropriately and fire master.py script. If you find any issues, please follow the log error message accordingly.

File is as attached

File Attachment:
File Name: build.bat.txt
File Size:0 KB

File Attachment:
File Name: config.ini.txt
File Size:0 KB

File Attachment:
File Name: Index.txt
File Size:0 KB

File Attachment:
File Name: master.txt
File Size:4 KB
Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Rajesh Kumar
Follow me
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x