def build_ci_images(self): run(f""" docker login aux.registry.local --username {self.env.registry.username} -p{self.env.registry.password} docker build -f {self.env.comm}/docker/Dockerfile.python-ci \\ -t python-cg-ci {self.env.plasma.root} \\ --build-arg PYTHON_VER_MAJOR={self.env.python.ver_major} \\ --build-arg PYTHON_VER_MINOR={self.env.python.ver_minor} \\ --build-arg PYTHON_VER_PATCH={self.env.python.ver_patch} \\ --build-arg DEBIAN_VER={self.env.debian_ver} docker tag python-cg-ci aux.registry.local/python-cg-ci docker push aux.registry.local/python-cg-ci docker build -f {self.env.comm}/docker/Dockerfile.kube-ci -t kube-cg-ci {self.env.plasma.root} \\ --build-arg PYTHON_VER_MAJOR={self.env.python.ver_major} \\ --build-arg PYTHON_VER_MINOR={self.env.python.ver_minor} \\ --build-arg PYTHON_VER_PATCH={self.env.python.ver_patch} \\ --build-arg DEBIAN_VER={self.env.debian_ver} docker tag kube-cg-ci aux.registry.local/kube-cg-ci docker push aux.registry.local/kube-cg-ci docker build -f {self.env.comm}/docker/Dockerfile.ubuntu-ci -t ubuntu-cg-ci {self.env.plasma.root} docker tag ubuntu-cg-ci aux.registry.local/ubuntu-cg-ci docker push aux.registry.local/ubuntu-cg-ci """, print_output=True)
def test(self) -> None: print("Testing Plasma common libraries") run(f""" cd {self.env.root} pytest comm/python/tests """, print_output=True)
def test_shell(env, stage): output: List[str] = run(f"./shell.py {stage} --dry-run") assert len(output) output: List[str] = run(f"./shell.py {stage} --dry-run --save") Path(f".env_{stage}").unlink() assert len(output) != 0
def add_hosts(self): super().add_hosts() run(f""" {self.sudo()} hostess add {self.env.photos.address} {self.env.device.ip} {self.sudo()} hostess add {self.env.registry.address} {self.env.device.ip} {self.sudo()} hostess add {self.env.minio.address} {self.env.device.ip} """)
def deploy(self) -> None: super().deploy() run("helm repo add codecentric https://codecentric.github.io/helm-charts" ) self.helm_release = self.li.namespace.helm(self.se.name) self.helm_release.install("codecentric/keycloak", "7.2.0") self.seed()
def add_hosts(self): super().add_hosts() cluster_ip = self.li.device.get_ip() run(f""" {self.sudo()} env "PATH=$PATH" hostess add {self.env.registry.address} {cluster_ip} {self.sudo()} env "PATH=$PATH" hostess add {self.env.keycloak.address} {cluster_ip} {self.sudo()} env "PATH=$PATH" hostess add {self.env.backend.address} {cluster_ip} {self.sudo()} env "PATH=$PATH" hostess add {self.env.appgen.address} {cluster_ip} {self.sudo()} env "PATH=$PATH" hostess add {self.env.frontend.address} {cluster_ip} """)
def bootstrap(self) -> None: print("Bootstrapping Plasma Monorepo") if self.is_ci_job(): run(f""" apt update apt install sudo -y """) if sys.version_info[0] != 3 or sys.version_info[ 1] != 8 or sys.version_info[2] != 1: self.install_python()
def install_python(self) -> None: print(f"Installing Python {self.env.python.ver}") run(f""" {self.sudo()} apt install curl git-core gcc make zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev libssl-dev git clone https://github.com/pyenv/pyenv.git $HOME/.pyenv export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)" pyenv install {self.env.python.ver} """)
def deploy(self) -> None: super().deploy() # run("kubectl apply --validate=false -f k8s/crds.yaml") run("kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.14.0/cert-manager.crds.yaml" ) # kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin self.li.namespace.helm(self.se.name).install( "jetstack/cert-manager", "0.14.0", repo="jetstack https://charts.jetstack.io") self.li.namespace.apply_yaml("k8s/issuer.yaml")
def deploy(self) -> None: super().deploy() run("helm repo add gitlab https://charts.gitlab.io") self.runner.install(chart="gitlab/gitlab-runner", version="0.12.0")