This commit is contained in:
Hanzhang Zeng (Roger) 2019-05-13 16:22:56 -07:00
Родитель def8f5b9fa
Коммит 961b28554a
5 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -35,7 +35,7 @@ class ProjectManager(BaseManager):
self._config = Configuration(base_url=base_url)
self._client = ServiceClient(creds, self._config)
self._credentials = creds
#need to make a secondary client for the creating project as it uses a different base url
# Need to make a secondary client for the creating project as it uses a different base url
self._create_project_config = Configuration(base_url=create_project_url)
self._create_project_client = ServiceClient(creds, self._create_project_config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}

Просмотреть файл

@ -11,6 +11,7 @@ from ..exceptions import (
)
from ..base.base_github_manager import BaseGithubManager
class GithubRepositoryManager(BaseGithubManager):
def check_github_repository(self, repository_fullname):
@ -91,6 +92,7 @@ class GithubRepositoryManager(BaseGithubManager):
def commit_file(self, repository_fullname, file_path, commit_message, file_data, sha=None, encode='utf-8'):
data = {
"branch": "master",
"message": "{message}".format(message=commit_message),
"content": base64.b64encode(bytes(file_data.encode(encode))).decode('ascii'),
}

Просмотреть файл

@ -13,6 +13,7 @@ except ImportError:
from subprocess import STDOUT, check_call, check_output, CalledProcessError
from ..exceptions import GitOperationException
def does_git_exist():
try:
check_call("git", stdout=DEVNULL, stderr=STDOUT)
@ -23,9 +24,11 @@ def does_git_exist():
return False
return True
def does_local_git_repository_exist():
return os.path.exists(".git")
def does_git_remote_exist(remote_name):
command = ["git", "remote", "show"]
try:
@ -35,6 +38,7 @@ def does_git_remote_exist(remote_name):
return remote_name in output
def does_git_has_credential_manager():
command = ["git", "config", "--list"]
try:
@ -44,6 +48,7 @@ def does_git_has_credential_manager():
return "credential.helper=manager" in output
def git_init():
command = ["git", "init"]
try:
@ -51,6 +56,7 @@ def git_init():
except CalledProcessError:
raise GitOperationException(message=" ".join(command))
def git_add_remote(remote_name, remote_url):
command = ["git", "remote", "add", remote_name, remote_url]
try:
@ -58,6 +64,7 @@ def git_add_remote(remote_name, remote_url):
except CalledProcessError:
raise GitOperationException(message=" ".join(command))
def git_remove_remote(remote_name):
command = ["git", "remote", "remove", remote_name]
try:
@ -65,6 +72,7 @@ def git_remove_remote(remote_name):
except CalledProcessError:
raise GitOperationException(message=" ".join(command))
def git_stage_all():
command = ["git", "add", "--all"]
try:
@ -72,6 +80,7 @@ def git_stage_all():
except CalledProcessError:
raise GitOperationException(message=" ".join(command))
def git_commit(message):
command = ["git", "commit", "--allow-empty", "--message", message]
try:
@ -79,6 +88,7 @@ def git_commit(message):
except CalledProcessError:
raise GitOperationException(message=" ".join(command))
def git_push(remote_name, force=False):
command = ["git", "push", remote_name, "--all"]
@ -90,6 +100,7 @@ def git_push(remote_name, force=False):
except CalledProcessError:
raise GitOperationException(message=" ".join(command))
def _sanitize_git_remote_name(organization_name, project_name, repository_name):
concatenated_remote_name = "{organization_name}_{project_name}_{repository_name}".format(
organization_name=organization_name,
@ -99,6 +110,7 @@ def _sanitize_git_remote_name(organization_name, project_name, repository_name):
sanitized_remote_name = re.sub(r"[^A-Za-z0-9_-]|\s", "-", concatenated_remote_name)
return sanitized_remote_name
def construct_git_remote_name(organization_name, project_name, repository_name, remote_prefix):
remote_name = "_{prefix}_{name}".format(
prefix=remote_prefix,
@ -106,6 +118,7 @@ def construct_git_remote_name(organization_name, project_name, repository_name,
)
return remote_name
def construct_git_remote_url(organization_name, project_name, repository_name, domain_name="dev.azure.com"):
url = "https://{domain}/{org}/{proj}/_git/{repo}".format(
domain=domain_name,

Просмотреть файл

@ -8,6 +8,7 @@ from jinja2 import Environment, FileSystemLoader, select_autoescape
from ..constants import (WINDOWS, PYTHON, NODE, DOTNET, POWERSHELL)
from ..exceptions import LanguageNotSupportException
class YamlManager(object):
""" Generate yaml files for devops

Просмотреть файл

@ -8,7 +8,7 @@ from os import path
from setuptools import setup, find_packages
NAME = "azure-functions-devops-build"
VERSION = "0.0.21"
VERSION = "0.0.22"
REQUIRES = ["msrest",
"vsts",