-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Migrate artifact hosting to cloudsmith #394
Changes from all commits
10b24e4
9b9dbad
71a79e0
3732707
51dd9b4
3c1f734
50828d6
eeeb7fb
347c861
ffd7d4d
c11c66c
13340b1
deb89ba
21ec936
699ece2
4226b36
09e4085
6280fa9
4744ec5
38c6d27
72ef8d6
4c63d32
b622817
f3688df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,27 +187,25 @@ def assemble_apt(name, | |
|
||
|
||
def _deploy_apt_impl(ctx): | ||
_deploy_script = ctx.actions.declare_file(ctx.attr.deploy_script_name) | ||
package_path = ctx.files.target[0].short_path | ||
ctx.actions.expand_template( | ||
template = ctx.file._deployment_script, | ||
output = ctx.outputs.deployment_script, | ||
output = _deploy_script, | ||
substitutions = { | ||
'{snapshot}' : ctx.attr.snapshot, | ||
'{release}' : ctx.attr.release | ||
'{release}' : ctx.attr.release, | ||
'{package_path}' : package_path, | ||
}, | ||
is_executable = True | ||
) | ||
|
||
symlinks = { | ||
'package.deb': ctx.files.target[0], | ||
} | ||
deployment_lib_files = ctx.attr._deployment_wrapper_lib[DefaultInfo].default_runfiles.files.to_list() | ||
return DefaultInfo(executable = _deploy_script, | ||
runfiles = ctx.runfiles(files=[ctx.files.target[0]] + deployment_lib_files)) | ||
|
||
return DefaultInfo(executable = ctx.outputs.deployment_script, | ||
runfiles = ctx.runfiles( | ||
files=[ctx.files.target[0]], | ||
symlinks = symlinks)) | ||
|
||
|
||
deploy_apt = rule( | ||
_deploy_apt = rule( | ||
attrs = { | ||
"target": attr.label( | ||
doc = 'assemble_apt label to deploy' | ||
|
@@ -220,13 +218,17 @@ deploy_apt = rule( | |
mandatory = True, | ||
doc = 'Release repository to deploy apt artifact to' | ||
), | ||
"_deployment_wrapper_lib": attr.label( | ||
default = "//common/uploader:uploader", | ||
), | ||
"_deployment_script": attr.label( | ||
allow_single_file = True, | ||
default = "//apt/templates:deploy.py" | ||
), | ||
}, | ||
outputs = { | ||
"deployment_script": "%{name}.sh", | ||
"deploy_script_name": attr.string( | ||
mandatory = True, | ||
doc = 'Name of instantiated deployment script' | ||
), | ||
}, | ||
implementation = _deploy_apt_impl, | ||
executable = True, | ||
|
@@ -235,3 +237,22 @@ deploy_apt = rule( | |
Select deployment to `snapshot` or `release` repository with `bazel run //:some-deploy-apt -- [snapshot|release] | ||
""" | ||
) | ||
|
||
def deploy_apt(name, target, snapshot, release, **kwargs): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be able to either deploy to cloudsmith apt (if we use the Same applies to Artifact and anything else using The rules should still able to interchange with snapshot (say Docker) and release (DockerHub) right? |
||
deploy_script_target_name = name + "__deploy" | ||
deploy_script_name = deploy_script_target_name + "-deploy.py" | ||
|
||
_deploy_apt( | ||
name = deploy_script_target_name, | ||
target = target, | ||
snapshot = snapshot, | ||
release = release, | ||
deploy_script_name = deploy_script_name, | ||
**kwargs | ||
) | ||
|
||
native.py_binary( | ||
name = name, | ||
srcs = [deploy_script_target_name], | ||
main = deploy_script_name, | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,11 +51,11 @@ def _deploy_artifact_impl(ctx): | |
symlinks = { | ||
'VERSION': version_file, | ||
} | ||
|
||
deployment_lib_files = ctx.attr._deployment_wrapper_lib[DefaultInfo].default_runfiles.files.to_list() | ||
return DefaultInfo( | ||
executable = _deploy_script, | ||
runfiles = ctx.runfiles( | ||
files = files, | ||
files = files + deployment_lib_files, | ||
symlinks = symlinks, | ||
), | ||
) | ||
|
@@ -84,6 +84,9 @@ _deploy_artifact = rule( | |
doc = "The artifact filename, automatic from the target file if not specified", | ||
default = '', | ||
), | ||
"_deployment_wrapper_lib": attr.label( | ||
default = "//common/uploader:uploader", | ||
), | ||
"_deploy_script_template": attr.label( | ||
allow_single_file = True, | ||
default = "//artifact/templates:deploy.py", | ||
|
@@ -165,7 +168,7 @@ def artifact_file(name, | |
|
||
http_file( | ||
name = name, | ||
urls = ["{}/{}/{}/{}".format(repository_url, group_name, version, artifact_name)], | ||
urls = ["{}/names/{}/versions/{}/{}".format(repository_url.rstrip("/"), group_name, version, artifact_name)], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Broke if the url had a trailing |
||
downloaded_file_path = artifact_name, | ||
sha = sha, | ||
tags = tags + ["{}={}".format(versiontype, version)], | ||
|
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.
Removes rpm targets