This repository has been archived by the owner on May 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
34fdfd1
commit f0b847c
Showing
3 changed files
with
90 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
--- | ||
os: linux | ||
dist: xenial # Python3.7 virtualenv is available only on Travis Xenial VMs. | ||
language: go | ||
sudo: false | ||
sudo: true | ||
go: | ||
- "1.13" | ||
env: | ||
- GO111MODULE=on | ||
|
||
install: true | ||
|
||
before_install: | ||
- sudo apt-get update -q | ||
- sudo apt-get install -y python3 python3-dev python3-pip python3-setuptools | ||
- sudo pip3 install -r scripts/requirements.txt | ||
install: | ||
- true # just skip | ||
script: | ||
- go test -v | ||
after_success: | ||
- test -n "$TRAVIS_TAG" && curl -sL https://git.io/goreleaser | bash | ||
- test -n "$TRAVIS_TAG" && python3 -u scripts/upload2qiniu.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
qiniu~=7.2 | ||
retry~=0.9.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# coding: utf-8 | ||
|
||
import argparse | ||
import glob | ||
import re | ||
import logging | ||
import os | ||
|
||
import qiniu.config | ||
from qiniu import Auth, etag, put_file | ||
from qiniu import Zone, set_default | ||
from retry import retry | ||
|
||
class Qiniu: | ||
def __init__(self, access_key, secret_key, bucket_name: str): | ||
self._access_key = access_key | ||
self._secret_key = secret_key | ||
self._auth = Auth(access_key, secret_key) | ||
self._bucket = bucket_name | ||
|
||
@retry(tries=5, delay=0.5, jitter=0.1, logger=logging) | ||
def upload_file(self, key, localfile): | ||
token = self._auth.upload_token(self._bucket, key) | ||
ret, info = put_file(token, key, localfile) | ||
if ret: # ret possibly is None | ||
assert ret['key'] == key | ||
assert ret['hash'] == etag(localfile) | ||
return info | ||
|
||
|
||
access_key = 'caBese-UQYXwQeigGqtdgwybP2Qh2AlDPdcEd42C' | ||
secret_key = 'SIG4DGyO45aseWSvOc9Be-ZkGrxoc-IpWlM5xts8' | ||
|
||
zone = Zone(up_host='https://up.qiniup.com', | ||
up_host_backup='https://upload.qiniup.com', | ||
io_host='http://iovip.qbox.me', | ||
scheme='https') | ||
set_default(default_zone=zone) | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-A", | ||
'--access-key', | ||
help='access key, env-var QINIU_ACCESS_KEY', | ||
default=os.environ.get("QINIU_ACCESS_KEY", access_key)) | ||
parser.add_argument("-S", | ||
"--secret-key", | ||
help='secret key, env-var QINIU_SECRET_KEY', | ||
default=os.environ.get("QINIU_SECRET_KEY", secret_key)) | ||
parser.add_argument("-B", | ||
"--bucket", | ||
help='bucket name', | ||
default=os.environ.get("QINIU_BUCKET", "atxupload")) | ||
args = parser.parse_args() | ||
|
||
assert args.access_key | ||
assert args.secret_key | ||
assert args.bucket | ||
|
||
qn = Qiniu(args.access_key, args.secret_key, args.bucket) | ||
checksum_path = glob.glob("*/atx-agent_*_checksums.txt")[0] | ||
distdir = os.path.dirname(checksum_path) | ||
|
||
version = re.search(r"([\d.]+)", checksum_path).group(0) | ||
print(checksum_path, version) | ||
key_prefix = "openatx/atx-agent/releases/download/" + version + "/" | ||
qn.upload_file(key_prefix + os.path.basename(checksum_path), checksum_path) | ||
with open(checksum_path, 'r', encoding='utf-8') as f: | ||
for line in f: | ||
_, filename = line.split() | ||
key = key_prefix + filename | ||
print("-", filename, "->", key) | ||
qn.upload_file(key, os.path.join(distdir, filename)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
f0b847c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
新手机 ,Andriod 10 ,执行"/data/local/tmp/atx-agent version # 查看版本
/data/local/tmp/atx-agent server -d # # 启动atx-agent并切换到后台运行" 这两个命令,都报“Segmentation fault”,该怎么解决呢? 已经尝试了arm7 、arm6 、AMD64