腾讯云路径刷新功能添加,本地更新脚本完善。

master
gaoxin 2021-06-15 14:44:23 +08:00
parent 4fb90b86d4
commit 91b23d6f4b
8 changed files with 67 additions and 23 deletions

35
Tools/cos/Flush.py 100644
View File

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
import json
import sys
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.cdn.v20180606 import cdn_client, models
if sys.argv.__len__() == 2:
try:
path = sys.argv[1]
cred = credential.Credential("AKIDRJxLRFFzwcmiNlLzqPggdplPlrpVec2A", "zh8JDqJZYLq42j9NL2RYOyGI9kDOIGxN")
httpProfile = HttpProfile()
httpProfile.endpoint = "cdn.tencentcloudapi.com"
clientProfile = ClientProfile()
clientProfile.httpProfile = httpProfile
client = cdn_client.CdnClient(cred, "", clientProfile)
req = models.PurgePathCacheRequest()
params = {
"Paths": [ path ],
"FlushType": "flush"
}
req.from_json_string(json.dumps(params))
resp = client.PurgePathCache(req)
print(resp.to_json_string())
except TencentCloudSDKException as err:
print(err)
else:
print("params error!")

View File

@ -1,4 +0,0 @@
依赖python 2.7
安装 腾讯云 cosclient
pip install cos-python-sdk-v5

View File

@ -98,7 +98,6 @@ class Cos_Upload():
if __name__ == '__main__': if __name__ == '__main__':
if sys.argv.__len__() == 4: if sys.argv.__len__() == 4:
print(sys.argv[1])
t = Cos_Upload(sys.argv[1], sys.argv[2], sys.argv[3]) t = Cos_Upload(sys.argv[1], sys.argv[2], sys.argv[3])
t.up() t.up()
else: else:

View File

@ -0,0 +1,7 @@
依赖python 2.7
安装 腾讯云 cosclient
pip install cos-python-sdk-v5
安装 tencentcloud-sdk-python
pip install tencentcloud-sdk-python

View File

@ -0,0 +1 @@
print("Local12 NO Flush!!")

View File

@ -27,18 +27,18 @@ class Local12_Upload():
self.fileList = [] self.fileList = []
self.ab_dir = abDir self.ab_dir = abDir
self.setting_dir = settingDir self.setting_dir = self.ab_dir + "/" + settingDir
self.change_version = changeVersion self.change_version = changeVersion
self.change_file = self.setting_dir + "/__HotFixLog/" + changeVersion + ".log" self.change_file = self.setting_dir + "/__HotFixLog/" + changeVersion + ".log"
self.loadSetting() self.loadSetting()
self.user = "root"
self.pwd = "root.ljsd.COM@"
def loadSetting(self): def loadSetting(self):
settingContent = open(self.setting_dir +"/"+ Local12_Upload.settingFile, "rb") settingContent = open(self.setting_dir +"/"+ Local12_Upload.settingFile, "rb")
settingJson = json.load(settingContent) settingJson = json.load(settingContent)
self.linux_sub_dir = settingJson["dir"] self.linux_sub_dir = settingJson["dir"]
self.platform = settingJson["platform"] self.platform = settingJson["platform"]
self.user = settingJson["user"]
self.pwd = settingJson["password"]
def get_all_file(self): def get_all_file(self):
print(self.change_file) print(self.change_file)
@ -63,14 +63,18 @@ class Local12_Upload():
pool = ProcessPoolExecutor(4) pool = ProcessPoolExecutor(4)
for file in filelist: for file in filelist:
self.upload_file_to_local12(self.ab_dir + "/" + self.platform + "/", file) self.upload_file_to_local12(self.ab_dir + "/" + self.platform + "/", file)
# pool.submit(self.upload_file_to_local12, file)
self.upload_file_to_local12(self.setting_dir +"/", Local12_Upload.configFile) self.upload_file_to_local12(self.setting_dir +"/", Local12_Upload.configFile)
self.upload_file_to_local12(self.setting_dir +"/", Local12_Upload.versionFile) self.upload_file_to_local12(self.setting_dir +"/", Local12_Upload.versionFile)
# pool.submit(self.upload_file_to_local12, self.setting_dir +"/"+ Local12_Upload.configFile)
# pool.submit(self.upload_file_to_local12, self.setting_dir +"/"+ Local12_Upload.versionFile)
z = Local12_Upload("D:/HotFix/Root/mht_china/local", "D:/HotFix/Root/mht_china/local/cdn_v2", 'version_1') if __name__ == '__main__':
z.up() if sys.argv.__len__() == 4:
t = Local12_Upload(sys.argv[1], sys.argv[2], sys.argv[3])
t.up()
else:
print("params error!")
# z = Local12_Upload("D:/HotFix/Root/mht_china/local", "D:/HotFix/Root/mht_china/local/cdn_v2", 'version_1')
# z.up()

View File

@ -0,0 +1 @@
依赖于 pscp.exe 向linux拷贝本地文件

View File

@ -1,4 +1,5 @@
# Auther: Wang Qi # -*- coding: utf-8 -*-
# # Auther: Wang Qi
# !/usr/bin/env python # !/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
import os import os
@ -10,8 +11,8 @@ import requests
import subprocess import subprocess
import urllib3 import urllib3
import logging import logging
import time import time
import random import random
import argparse import argparse
from threading import Thread, current_thread from threading import Thread, current_thread
from concurrent.futures import ProcessPoolExecutor from concurrent.futures import ProcessPoolExecutor
@ -26,13 +27,13 @@ class jlrg():
fail_list = [] fail_list = []
logging.basicConfig(level=logging.INFO, stream=sys.stdout) logging.basicConfig(level=logging.INFO, stream=sys.stdout)
secret_id = 'AKIDRJxLRFFzwcmiNlLzqPggdplPlrpVec2A' # 替换为用户的 secretId secret_id = 'AKIDRJxLRFFzwcmiNlLzqPggdplPlrpVec2A' # <EFBFBD>滻Ϊ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD> secretId
secret_key = 'zh8JDqJZYLq42j9NL2RYOyGI9kDOIGxN' # 替换为用户的 secretKey secret_key = 'zh8JDqJZYLq42j9NL2RYOyGI9kDOIGxN' # <EFBFBD>滻Ϊ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD> secretKey
region = 'ap-guangzhou' # 替换为用户的 Region region = 'ap-guangzhou' # <EFBFBD>滻Ϊ<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD> Region
token = None # 使用临时密钥需要传入 Token默认为空可不填 token = None # ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Կ<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Token<65><6E>Ĭ<EFBFBD><C4AC>Ϊ<EFBFBD>գ<EFBFBD><D5A3>ɲ<EFBFBD><C9B2><EFBFBD>
scheme = 'https' # 指定使用 http/https 协议来访问 COS默认为 https可不填 scheme = 'https' # ָ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> http/https Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> COS<4F><53>Ĭ<EFBFBD><C4AC>Ϊ https<70><73><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD>
config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token, Scheme=scheme) config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token, Scheme=scheme)
# 2. 获取客户端对象 # 2. <EFBFBD><EFBFBD>ȡ<EFBFBD>ͻ<EFBFBD><EFBFBD>˶<EFBFBD><EFBFBD><EFBFBD>
client = CosS3Client(config) client = CosS3Client(config)
def __init__(self): def __init__(self):
@ -97,7 +98,7 @@ class jlrg():
https://dcdn.aliyuncs.com/?Action=RefreshDcdnObjectCaches&ObjectPath=download.gamenew-h5.com/Japan/SW/&ObjectType=Directory&Version=2018-01-15&Timestamp=2021-05-08T03:32:45Z&SignatureNonce=15215528852396&AccessKeyId=LTAIE4jRXhLBvVLL&SignatureMethod=HMAC-SHA1 #https://dcdn.aliyuncs.com/?Action=RefreshDcdnObjectCaches&ObjectPath=download.gamenew-h5.com/Japan/SW/&ObjectType=Directory&Version=2018-01-15&Timestamp=2021-05-08T03:32:45Z&SignatureNonce=15215528852396&AccessKeyId=LTAIE4jRXhLBvVLL&SignatureMethod=HMAC-SHA1
if __name__ == '__main__': if __name__ == '__main__':