From 038f4d21218d0d6270fd5de0f383ef944e685e85 Mon Sep 17 00:00:00 2001 From: TC Johnson Date: Mon, 29 Apr 2024 14:40:07 -0500 Subject: [PATCH] Added CICD dry run This is the first attempt at setting up a dry run pipeline to test changes to the CICD config without actually publishing the compiled binaries and packages built by the process. The dry run should be triggered by any changes to .gitlab-ci.yml or changes to any of the scripts under scripts/cicd/. --- .gitlab-ci.yml | 142 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c16d688b..d48765ff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,6 +55,8 @@ test_build: resource_group: test # when: manual +# Actual release -- triggered by pushing a new version tag + release_job: stage: release image: registry.gitlab.com/gitlab-org/release-cli:latest @@ -177,3 +179,143 @@ delete_build_machines: - bash scripts/cicd/build-orchestration/build-machine-ctrl.sh delete amd64-rpm rules: - if: '$CI_COMMIT_TAG =~ /v\d.+/' + +# Dryrun release -- triggered by changes in .gitlab-ci.yml or CICD scripts + +dryrun_create_build_machines: + stage: build_packages + tags: + - build-orchestration + script: + - bash scripts/cicd/build-orchestration/build-machine-ctrl.sh create amd64-deb + - bash scripts/cicd/build-orchestration/build-machine-ctrl.sh create arm64-deb + - bash scripts/cicd/build-orchestration/build-machine-ctrl.sh create amd64-rpm + rules: + - if: $CI_PIPELINE_SOURCE == "push" + changes: + - .gitlab-ci.yml + - scripts/cicd/**/* + +dryrun_package_amd64_deb: + stage: build_packages + needs: + - dryrun_create_build_machines + tags: + - build-amd64-deb + script: + - earthly bootstrap + - earthly +package-linux-amd64-deb + - bash scripts/cicd/build-machine/scp-to-orchestrator.sh + rules: + - if: $CI_PIPELINE_SOURCE == "push" + changes: + - .gitlab-ci.yml + - scripts/cicd/**/* + +dryrun_package_arm64_deb: + stage: build_packages + needs: + - dryrun_create_build_machines + tags: + - build-arm64-deb + script: + - earthly bootstrap + - earthly +package-linux-arm64-deb + - bash scripts/cicd/build-machine/scp-to-orchestrator.sh + rules: + - if: $CI_PIPELINE_SOURCE == "push" + changes: + - .gitlab-ci.yml + - scripts/cicd/**/* + +dryrun_package_amd64_rpm: + stage: build_packages + needs: + - dryrun_create_build_machines + tags: + - build-amd64-rpm + script: + - earthly bootstrap + - earthly +package-linux-amd64-rpm + - bash scripts/cicd/build-machine/scp-to-orchestrator.sh + rules: + - if: $CI_PIPELINE_SOURCE == "push" + changes: + - .gitlab-ci.yml + - scripts/cicd/**/* + +dryrun_publish_crates: + stage: build_packages + needs: + - dryrun_create_build_machines + tags: + - build-amd64-deb + script: + - vlt login + - vlt run --command="cargo publish -p veilid-tools --dry-run" + - vlt run --command="cargo publish -p veilid-core --dry-run" + rules: + - if: $CI_PIPELINE_SOURCE == "push" + changes: + - .gitlab-ci.yml + - scripts/cicd/**/* + +dryrun_publish_python: + stage: build_packages + needs: + - dryrun_create_build_machines + tags: + - build-amd64-deb + script: + - vlt login + - cd veilid-python && /home/gitlab-runner/.local/bin/poetry build + rules: + - if: $CI_PIPELINE_SOURCE == "push" + changes: + - .gitlab-ci.yml + - scripts/cicd/**/* + +dryrun_build_repositories: + stage: distribute + tags: + - build-orchestration + variables: + SECURE_FILES_DOWNLOAD_PATH: './' + script: + - cp scripts/cicd/build-orchestration/generate-release.sh ~ + - bash scripts/cicd/build-orchestration/distribute-packages.sh + rules: + - if: $CI_PIPELINE_SOURCE == "push" + changes: + - .gitlab-ci.yml + - scripts/cicd/**/* + +dryrun_deploy_repos: + stage: distribute + needs: + - dryrun_build_repositories + tags: + - repo-server + script: + - ls -al repo.tar + rules: + - if: $CI_PIPELINE_SOURCE == "push" + changes: + - .gitlab-ci.yml + - scripts/cicd/**/* + +dryrun_delete_build_machines: + stage: distribute + needs: + - dryrun_deploy_repos + tags: + - build-orchestration + script: + - bash scripts/cicd/build-orchestration/build-machine-ctrl.sh delete amd64-deb + - bash scripts/cicd/build-orchestration/build-machine-ctrl.sh delete arm64-deb + - bash scripts/cicd/build-orchestration/build-machine-ctrl.sh delete amd64-rpm + rules: + - if: $CI_PIPELINE_SOURCE == "push" + changes: + - .gitlab-ci.yml + - scripts/cicd/**/* \ No newline at end of file