diff --git a/recursive_vcs_import.py b/recursive_vcs_import.py index 36cbb2f..160460a 100755 --- a/recursive_vcs_import.py +++ b/recursive_vcs_import.py @@ -3,13 +3,15 @@ import pathlib import subprocess import sys -from typing import List +from typing import List, Optional -def findDotRepos(search_path: str) -> List[pathlib.Path]: - - return pathlib.Path(search_path).glob("**/*.repos") +def findDotRepos(search_path: str, clone_path: Optional[str]=None) -> List[pathlib.Path]: + repos = list(pathlib.Path(search_path).glob("**/*.repos")) + if clone_path is not None: + repos.extend(list(pathlib.Path(clone_path).glob("**/*.repos"))) + return repos def main(): @@ -19,7 +21,7 @@ def main(): while True: - found_repos = findDotRepos(search_path) + found_repos = findDotRepos(search_path, clone_path) remaining_repos = set(found_repos) - set(cloned_repos) if not remaining_repos: @@ -32,6 +34,8 @@ def main(): raise RuntimeError("vcs import failed") cloned_repos.append(next_repo) + + print(" ".join([str(repo) for repo in set(found_repos)])) if __name__ == "__main__": diff --git a/templates/.gitlab-ci.template.yml b/templates/.gitlab-ci.template.yml index f9d94c5..d61064e 100644 --- a/templates/.gitlab-ci.template.yml +++ b/templates/.gitlab-ci.template.yml @@ -56,7 +56,7 @@ default: tags: - privileged - amd64 - before_script: + before_script: &default_before_script - |- if [[ ! -d $DOCKER_COMPOSE_DIR/docker-ros ]]; then git config --global url.${CI_SERVER_PROTOCOL}://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}.insteadOf ${CI_SERVER_URL} @@ -137,16 +137,20 @@ run-arm64: .test: variables: - UPSTREAM_WORKSPACE: $ROS_DIR/.repos TARGET_WORKSPACE: $ROS_DIR ADDITIONAL_DEBS: git AFTER_INIT_EMBED: git config --global url.${CI_SERVER_PROTOCOL}://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}.insteadOf ${CI_SERVER_URL} DOCKER_RUN_OPTS: -u root:root before_script: - - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - - apk add --update bash coreutils grep tar + - *default_before_script + - cd - + - apk add --update bash coreutils grep tar python3 py3-pip + - pip install vcstool + - UPSTREAM_WORKSPACE=$(python3 $DOCKER_COMPOSE_DIR/docker-ros/recursive_vcs_import.py $ROS_DIR | tail -1) + - if [ -z "$UPSTREAM_WORKSPACE" ]; then echo "repositories:" > $ROS_DIR/.repos; UPSTREAM_WORKSPACE=$ROS_DIR/.repos; fi + - echo $UPSTREAM_WORKSPACE + - export UPSTREAM_WORKSPACE - git clone --branch master --depth 1 https://github.com/ros-industrial/industrial_ci.git .industrial_ci - - test -f $ROS_DIR/.repos || echo "repositories:" > $ROS_DIR/.repos script: .industrial_ci/gitlab.sh Test dev-amd64: