Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
sun
Commits
43b47139
Commit
43b47139
authored
Feb 18, 2019
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alpha渠道打包
parent
6c65e5d9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
17 deletions
+65
-17
channel_build.py
api/channel_build.py
+0
-0
requirements.txt
requirements.txt
+3
-2
settings.py
sun/settings.py
+6
-1
channel_task.py
utils/channel_task.py
+56
-14
No files found.
api/channel_build.py
View file @
43b47139
This diff is collapsed.
Click to expand it.
requirements.txt
View file @
43b47139
...
...
@@ -15,4 +15,5 @@ git+ssh://git@git.wanmeizhensuo.com/system/gm-tracer.git@v0.1.2
git+ssh://git@git.wanmeizhensuo.com/alpha/alpha-types.git@master
filetype
==1.0.2
Pillow
==5.4.1
celery
==4.2.1
\ No newline at end of file
celery
==4.2.1
requests
==2.21.0
\ No newline at end of file
sun/settings.py
View file @
43b47139
...
...
@@ -158,4 +158,9 @@ OPERATOR_PASSWORD = 123456
# 图片下载的存储路径
DOWNLOAD_IMAGE_PATH
=
u'/data/header-images/'
#
# apk 七牛上传空间
APK_SCOPE
=
'download'
APK_DOMAIN
=
'http://dl.igengmei.com/'
DEFAULT_CHANNEL
=
'benzhan'
APK_RELEASE_DIR
=
'sun'
APK_BUILD_DIR
=
'sun_build'
utils/channel_task.py
View file @
43b47139
from
celery
import
shared_task
from
django.conf
import
settings
import
requests
from
gm_upload.utils.qiniu_tool
import
QiniuTool
from
middleware.rpc
import
rpc_invoker
from
utils.channel_package_tools
import
ChannelPackage
from
utils.logger
import
log_error
from
utils.logger
import
log_error
,
info_logger
@shared_task
def
version_release_task
(
packed_channels
):
# 一键发布,发布完成邮件通知
def
version_release_task
(
packed_channels
,
version_id
=
None
,
version
=
None
):
# 一键发布,发布完成邮件通知
rpc
=
rpc_invoker
channels
=
[]
for
vtc
in
packed_channels
:
version
=
vtc
[
'version'
]
channel
=
v
tc
[
'channel
'
]
vtc_id
=
vtc
[
'id'
]
version
=
version
channel_ids
=
list
()
for
version2channel
in
packed_channels
:
channel
=
v
ersion2channel
[
'url_name
'
]
channel_ids
.
append
(
version2channel
.
get
(
'id'
))
try
:
ChannelPackage
.
publish_apk
(
channel
,
version
)
rpc
[
'endpoint'
](
version_id
=
vtc_id
)
.
unwrap
()
channels
.
append
(
channel
)
except
:
log_error
()
raise
# send email
rpc
.
origin
[
'hera/channelbuild/version_release_notify'
](
version
=
version
,
channels
=
channels
,
raise
Exception
(
'发布失败'
)
# 发布
rpc
[
'sun/channel_build/version/release'
](
version_id
=
version_id
,
channel_ids
=
channel_ids
)
.
unwrap
()
# email notify
# rpc.origin['endpoint'](version=version, channels=channels).unwrap()
@shared_task
def
channel_build_one
(
version
=
None
,
channel
=
None
,
data
=
None
):
url
=
ChannelPackage
.
apk_url
(
''
,
version
)
r
=
requests
.
get
(
url
)
chn_pkg
=
ChannelPackage
(
r
.
content
,
version
)
build_one_channel
(
chn_pkg
,
channel
)
@shared_task
def
channel_build
(
version
=
None
,
channels
=
None
,
data
=
None
):
url
=
ChannelPackage
.
apk_key
(
''
,
version
)
QiniuTool
.
delete
(
url
,
settings
.
APK_SCOPE
)
QiniuTool
.
upload
(
data
,
url
,
settings
.
APK_SCOPE
)
if
channels
is
None
:
channels
=
[
settings
.
DEFAULT_CHANNEL
]
elif
settings
.
DEFAULT_CHANNEL
not
in
channels
:
channels
.
append
(
settings
.
DEFAULT_CHANNEL
)
info_logger
.
debug
(
channels
)
chn_pkg
=
ChannelPackage
(
data
,
version
)
# 遍历渠道号并创建对应渠道号的apk文件
for
channel
in
channels
:
build_one_channel
(
chn_pkg
,
channel
)
def
build_one_channel
(
pkg_obj
,
channel
):
info_logger
.
debug
(
channel
)
if
not
channel
:
return
channel
=
channel
.
strip
()
ret
=
pkg_obj
.
upload_apk
(
channel
)
info_logger
.
debug
(
ret
)
if
'file'
in
ret
:
# TODO 打包
rpc_invoker
[
'endpoint'
](
version
=
pkg_obj
.
version
,
channel
=
channel
)
.
unwrap
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment