Perforce User Guide
Modifying a Deployment Script
-
Download the script ArtEase-deploy.sh in "Management -> Staff Management -> Deployment Script Download".
-
Use a text editor to open the script. Notepad++, rather than Notepad, is recommended.
-
Find the following piece of code in the script, then add environment variables and mount.
log_info "launch docker container..."
if [[ "${system}" != "windows" ]]; then
docker run -d -P --name ${CONTAINER_NAME} \
--net=bridge \
--restart always\
-v ~/.subversion/:/root/.subversion \
-v /tmp:/tmp \
# Mount the resource directory, the following case indicates that should be located in your server under: /home/artease/artclient_p4,
# in the corresponding container: /home/artease/artclient_p4/workspace
-v /home/artease/artclient_p4:/home/artease/artclient_p4/workspace \
${docker_mount_str} \
-e GROUP="${GROUP}" \
-e HOST_SYSTEM="${system}" \
-e DEBUG="${DEBUG}" \
-e SVN_PATH="${res_path_str}" \
-e MOUNT_PATH="${mount_path_str}" \
#See here...
#According to the lines above, add the following code:
-e P4USER="Perforce Username" \
-e P4PASSWORD="User Password" \
-e P4PORT="Perforce Server IP Address: Port Number" \
-e STREAM="The warehouse from which you want to pull data - start writing after Perforce Warehouse followed by a double-slash and end without a slash at the end" \
-e P4ROOT="Art resource root path, art resources in the container's root path, e.g. /home/mine; begin writing from the system root directory in the container." \
-e WS="Work Directory, if this isn't created automatically it will be under the root path, e.g. WS='workspace', then art resources will be downloaded under /home/mine/workspace"\
dockerhub.nie.netease.com/artease/artease_runner
# Add the six environment variables above
# The environment variables for Windows have been added below. The method is the same as above.
else
docker run -d -P --name ${CONTAINER_NAME} \
--net=bridge \
--restart always\
-v C:/Users/${user}/AppData/Roaming/Subversion:/root/.subversion \
${docker_mount_str} \
-e GROUP="${GROUP}" \
-e HOST_SYSTEM="${system}" \
-e DEBUG="${DEBUG}" \
-e SVN_PATH="${res_path_str}" \
-e MOUNT_PATH="${mount_path_str}" \
dockerhub.nie.netease.com/artease/artease_runner
fi
Important Information:
P4USER="Perforce Username"; if this is a corporate email provided by the company, add the email prefix here.
STREAM: Indicates the warehouse from which you want to pull; if you fill in "depot_g0001/test", then all resources under 'test' will be pulled. There should be no forward slash following test.
P4PORT: Tests on the current SSL connection method currently show that it can be used normally with the format "ssl:server domain name or IP:1666".
Remember: When adding environment variables, do not forget to finish with a backslash "/", and that there must be no gaps between each line.
The user password is optional and can be left blank.
Deploying a Script
Use the root user in the server to deploy the script.
chmod +x ArtEase-deploy.sh
bash ArtEase-deploy.sh
Opening an Inspection Task
Using a Script to Open an Inspection Task
In previous tasks, the default user used is SVN. If you are using Perforce, you must designate the 'version_type' parameter as '1'.
For how to use Python scripts to create inspection tasks, consult the files on the use of incremental and full inspections.
Creating Perforce Inspection Tasks: An Example
check_path: Inspection path
perforce_command: You can enter multiple commands that you want to run in the container, using English commas to separate them. The results of the commands will be returned to the callback interface.
Tip: After creating an inspection task, pay close attention to the log printout to check the configuration is correct.
Full Inspection
import json
import requests
headers = {
'Content-Type': 'application/json'
}
data = {
"params":{
"author": "xxxx@corp.netease.com", # POPO Account
"scheme": "Program Name",
"callback": True or False, # whether or not callback is required
"remind": 1, # 1 indicates that a POPO reminder will be received,0 indicates that a reminder will not be received
"version_type": 1, # 1 indicates Perforce,0 indicates SVN,0 is the default
"check_path": "/home/artease/artclient/perforce/workspace/test1",
"perforce_command": ['p4 changes -m 1'] # Return to 1 most recent changelist
}
}
artease_url = 'Official Website: Management->Server Management->WebHook->Check Correctness of WebHook Interface'
res = requests.post(artease_url, data=json.dumps(data), headers=headers
Incremental Inspection
import json
import requests
headers = {
'Content-Type': 'application/json'
}
data = {
"svn_commit":{
"author": "xxxx@corp.netease.com", # POPO Account
"scheme": "Program Name",
"callback": True or False, # whether or not callback is required
"remind": 1, # 1 indicates that a POPO reminder will be received,0 indicates that a reminder will not be received
"version_type": 1, # 1 indicates Perforce,0 indicates SVN,0 is the default
"files":[ [ "U", "Incremental File Address" ],[ "A", "Incremental File Address"] ] ,
"check_path": "/home/artease/artclient/perforce/workspace/test1",
"perforce_command": ['p4 changes -m 1'] # Return to 1 most recent changelist
}
}
artease_url = 'Official Website: Management->Server Management->WebHook->Check Correctness of WebHook Interface'
res = requests.post(artease_url, data=json.dumps(data), headers=headers)
The get changelist command runs before Perforce syncs, and other commands run after Perforce syncs
Inspect Path
Check that the path is specified in the script that creates the task!
Make certain to check the path! Ensure that the file path is correct!
Example:
P4ROOT="/home/mine"
WS="workspace"
STREAM="streamsDepot"
If the remote Perforce warehouse has the following directory structure:
Then, after syncing the remote warehouse with the local one the file path will be:
/home/mine/workspace/mainline/index
/home/mine/workspace/mainline/.~readme - copy.md
/home/mine/workspace/mainline/readme - copy.md
/home/mine/workspace/mainline/readme.md
If there is no inspection path specified, then the default inspection path is P4ROOT + WS,in the example above this would be:
/home/mine/workspace
If an inspection path has been specified, check the resources in the specified path. For example, specify the path below:
/home/mine/workspace/res/desk
Configuring on the Platform
On the [Management] - [Server Management] page you can run 'add Perforce task configurations'.