diff --git a/ci-test-manifest.yml b/ci-test-manifest.yml index f6b877ed17ed7b9227bbc581963dc42d994ca019..7907b4bbd471e8fb77d71889948a7c1b69b40e16 100644 --- a/ci-test-manifest.yml +++ b/ci-test-manifest.yml @@ -192,7 +192,7 @@ build:merge_request: # -------------------------------------------------------------------------------------- # Stage: test # -------------------------------------------------------------------------------------- -.test: +.test-simple: stage: test rules: - if: $CI_COMMIT_REF_NAME != $MASTER_BRANCH_MANIFEST || $CI_PIPELINE_SOURCE == "api" @@ -206,12 +206,85 @@ build:merge_request: test:pass: extends: - - .test + - .test-simple variables: RETURNCODE: 0 test:fail: extends: - - .test + - .test-simple variables: RETURNCODE: 1 + +# --------------------------------------------------------------------------------------- +# Stage: test +# --------------------------------------------------------------------------------------- +.test: + extends: + - .infrastructure + timeout: 1h + rules: + - if: $CI_COMMIT_REF_NAME != $MASTER_BRANCH_MANIFEST || $CI_PIPELINE_SOURCE == "api" + when: manual + allow_failure: true + variables: + # Include git submodules + GIT_SUBMODULE_STRATEGY: recursive + CI_PARAM_TEST_SUITE: '{platform}.jinja2' + CI_PARAM_EXTRA: --nop + LOGPREFIX: "CI:test:" + artifacts: + when: always + paths: + - "results/**" + reports: + junit: results/results-*.xml + before_script: + # Setup ssh key to access private repos + # https://docs.gitlab.com/ee/ci/ssh_keys/#ssh-keys-when-using-the-docker-executor + # An SSH keypair has been generated for the manifest's pipeline to be able to access + # all private repositories in the manifest. The private key has been stored in the + # CI/CD variable GITLAB_PRIVATE_KEY of the manifest repository. The public key has + # been added as a deploy key in GitLab's repository settings for all contained + # repositories. + - echo "${LOGPREFIX} Setup SSH" + - eval $(ssh-agent -s) + - echo "$GITLAB_PRIVATE_KEY" | tr -d '\r' | ssh-add - + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + # Add GitLab server to known hosts + # https://docs.gitlab.com/ee/ci/ssh_keys/#verifying-the-ssh-host-keys + # In order to access the private repositories via SSH, the GitLab server has to be + # added to the known_hosts file. The host keys were determined using the command + # ssh-keyscan [-p port] <gitlab-server> + # and have been stored in the GITLAB_KNOWN_HOSTS CI/CD variable. + - echo "$GITLAB_KNOWN_HOSTS" >> ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + + script: + - |- + # Submit tests to lava server + # Use existing release as we don't build in CI-test + DEPLOYPATH_TEST="http://srv73/SoftwareStore/Linux-Yocto/Releases/" + RELEASE="Yocto-dunfell-15.0/" + INSTALLSCRIPT_ABS="$DEPLOYPATH_TEST/$RELEASE/$CI_PARAM_MACHINE/fng-install.sh" + FNG_INSTALL_URL="${INSTALLSCRIPT_ABS#/*/}" + .gitlab-ci/submit_test.py \ + --fng-install "${FNG_INSTALL_URL}" \ + --name \ + "Gitlab build test ${CI_PARAM_MACHINE} ${RELEASE} ${CI_PIPELINE_ID}" \ + --results-path "results" \ + --test-repo ${TESTS_GIT_URL} \ + --test-repo-branch dunfell \ + --test-plan ${CI_PARAM_TEST_SUITE} \ + ${CI_PARAM_EXTRA} \ + ${CI_PARAM_PLATFORMS} + +smoketest:imx6guf: + extends: .test + stage: test + variables: + CI_PARAM_MACHINE: imx6guf + CI_PARAM_PLATFORMS: imx6guf + CI_PARAM_TEST_SUITE: boot.jinja2 + CI_PARAM_EXTRA: --all-devices diff --git a/common.yml b/common.yml index 1724f71227ffd6e57b639b0972b45f33d19c0c55..c0215ec410c5f230ec38c2484e095c698b0059f7 100644 --- a/common.yml +++ b/common.yml @@ -22,6 +22,11 @@ variables: MASTER_BRANCH_MANIFEST: dunfell MASTER_BRANCH_PROJECT: dunfell + DEPLOYPATH_TEST: "/artifacts/${CI_JOB_ID}/" + GITLAB_SERVER: "${CI_SERVER_HOST}:${CI_SERVER_SSH_PORT}" + GIT_BASE_URL: "ssh://git@${GITLAB_SERVER}/${CI_PROJECT_ROOT_NAMESPACE}" + TESTS_GIT_URL: "${GIT_BASE_URL}/yocto/tests.git" + # -------------------------------------------------------------------------------------- # Common infrastructure settings diff --git a/deploy_gitlab_ci.py b/deploy_gitlab_ci.py index 8365e1175032c8160ecd9c8524f216c1cc481a00..88839d303732b3f1f9fd24731860eccb6b6689e0 100755 --- a/deploy_gitlab_ci.py +++ b/deploy_gitlab_ci.py @@ -174,7 +174,11 @@ def main(): args, _ = parser.parse_known_args() if args.verbose: - logging.basicConfig(level=logging.DEBUG) + logging.basicConfig( + level=logging.DEBUG, + format="%(asctime)s %(levelname)-8s %(message)s", + datefmt="%H:%M:%S", + ) gitlab = Gitlab(args.gitlab_url, private_token=args.token) diff --git a/manifest-build.yml b/manifest-build.yml index d408cf8ea1e707fe6f4f06c9914402fdd2bb3b95..4b9d0726c0cb6bc78dc21f9a645cc10161e28248 100644 --- a/manifest-build.yml +++ b/manifest-build.yml @@ -5,10 +5,6 @@ variables: IMAGEPATH: "${IMAGEBASEPATH}/${CI_PARAM_MACHINE}" LICENSESPATH: "tmp/deploy/licenses" SDKPATH: "tmp/deploy/sdk/" - DEPLOYPATH_TEST: "/artifacts/${CI_JOB_ID}/" - GITLAB_SERVER: "${CI_SERVER_HOST}:${CI_SERVER_SSH_PORT}" - GIT_BASE_URL: "ssh://git@${GITLAB_SERVER}/${CI_PROJECT_ROOT_NAMESPACE}" - TESTS_GIT_URL: "${GIT_BASE_URL}/yocto/tests.git" .docker_check: &docker_check # Check if the build folder is empty. Sometimes the docker volume for the build is not diff --git a/update_submodule.py b/update_submodule.py index c54b6ac6c2a3f474c379d2d8c077f9acbd2d1d3a..d22b47df3783230eaf16053945ba5241a2f0ba2a 100755 --- a/update_submodule.py +++ b/update_submodule.py @@ -373,7 +373,7 @@ def update_submodule_and_include_ref( # ======================================================== # Squash all commits on the integration branch to one # ======================================================== - project_repo.remotes.origin.fetch(branch) + project_repo.remotes.origin.fetch(branch, depth=5) gitlab_branch = project.branches.get(branch) project_repo.git.reset("--soft", gitlab_branch.commit["id"]) @@ -441,7 +441,11 @@ def main(): args, _ = parser.parse_known_args() if args.verbose: - logging.basicConfig(level=logging.DEBUG) + logging.basicConfig( + level=logging.DEBUG, + format="%(asctime)s %(levelname)-8s %(message)s", + datefmt="%H:%M:%S", + ) gitlab = Gitlab(args.gitlab_url, private_token=args.token) project = common.get_project(gitlab, args.project)