Commit e8d71add authored by José Henrique's avatar José Henrique
Browse files

Allow cloning private repos

parent ccf6de5e
......@@ -49,6 +49,14 @@ else:
sys.exit("Invalid version")
# Others
build_env_vars["private_repos"] = [
{
"url": "git@github.com:PixelExperience/packages_apps_FaceUnlockService.git",
"branch": build_env_vars["fallback_branch"],
"path": "packages/apps/FaceUnlockService"
}
]
build_env_vars["build_id"] = (
build_env_vars["device"] + "_" + build_env_vars["version"]
)
......@@ -75,3 +83,5 @@ if not os.path.exists(build_env_vars["ccache_dir"]):
build_env_vars["runner_name"] = build_env_vars["CI_RUNNER_DESCRIPTION"]
build_env_vars["post_build_dir"] = (
"post_build_" + build_env_vars["device"] + "_" + build_env_vars["version"])
build_env_vars["private_dir"] = (
"private_dir_" + build_env_vars["device"] + "_" + build_env_vars["version"])
......@@ -9,6 +9,9 @@ import json
import sys
import glob
import signal
import git
import shutil
from post_build_utils import sync_repo
docker_client = docker.from_env()
stop_check_thread = False
......@@ -149,7 +152,16 @@ def cleanup(build_env):
os.remove(build_data_file)
def sync_private_repos(environment_vars):
for repo in environment_vars["private_repos"]:
path = environment_vars["private_dir"] + "/" + repo["path"]
if os.path.exists(path):
shutil.rmtree(path)
sync_repo(repo["url"], path, repo["branch"])
def start_build(environment_vars):
sync_private_repos(environment_vars)
container_name = environment_vars["build_id"]
image_name = "pixelexperience/android_build_ci"
volumes_to_mount = {
......@@ -163,6 +175,13 @@ def start_build(environment_vars):
"bind": "/home/android_build/.gitcookies", "mode": "ro"
}
}
for repo in environment_vars["private_repos"]:
path = os.path.abspath(
environment_vars["private_dir"] + "/" + repo["path"]
)
volumes_to_mount[path] = {
"bind": "/android_private/" + repo["path"], "mode": "ro"
}
pull_image(image_name)
print("Starting build container, with environment variables: " +
json.dumps(environment_vars))
......
......@@ -10,10 +10,10 @@ files_to_upload = []
def sync_tools(post_build_env_vars):
for env_var in post_build_env_vars["tools"]:
if os.getenv("DEBUG") and os.path.exists(env_var["path"]):
for repo in post_build_env_vars["tools"]:
if os.getenv("DEBUG") and os.path.exists(repo["path"]):
return
sync_repo(env_var["url"], env_var["path"], env_var["branch"])
sync_repo(repo["url"], repo["path"], repo["branch"])
def create_release_zip(post_build_env_vars):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment