Skip to content
Snippets Groups Projects

ci: Build workhorse binaries and upload/download as generic package

All threads resolved!
Compare and Show latest version
3 files
+ 57
39
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -193,31 +193,13 @@ setup-test-env:
stage: prepare
variables:
SETUP_DB: "false"
TMP_TEST_FOLDER: "tmp/tests"
GITLAB_WORKHORSE_FOLDER: "gitlab-workhorse"
TMP_GITLAB_WORKHORSE_FOLDER: "tmp/${GITLAB_WORKHORSE_FOLDER}"
TMP_TEST_GITLAB_WORKHOSE_FOLDER: "${TMP_TEST_FOLDER}/${GITLAB_WORKHORSE_FOLDER}"
GITLAB_WORKHORSE_PACKAGE_FILES: "gitlab-resize-image gitlab-zip-cat gitlab-zip-metadata gitlab-workhorse WORKHORSE_TREE"
TMP_TEST_GITLAB_WORKHOSE_FOLDER: "${TMP_TEST_FOLDER}/gitlab-workhorse"
script:
- workhorse_tree=$(git rev-parse HEAD:workhorse)
- workhorse_binaries_file="workhorse-${workhorse_tree}.tar.gz"
- echo $workhorse_tree $workhorse_binaries_file
# Download the package
- 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/workhorse/${workhorse_tree}/${workhorse_binaries_file} || true'
- if [ -f "${workhorse_binaries_file}" ]; then
mkdir -p ${TMP_TEST_GITLAB_WORKHOSE_FOLDER};
tar -xzvf ${workhorse_binaries_file} -C ${TMP_TEST_FOLDER};
ls -al ${TMP_TEST_GITLAB_WORKHOSE_FOLDER};
else;
# Only keep the binaries in a temp folder
mkdir -p "${TMP_GITLAB_WORKHORSE_FOLDER}";
cd ${TMP_TEST_GITLAB_WORKHOSE_FOLDER} && cp ${GITLAB_WORKHORSE_PACKAGE_FILES} ${TMP_GITLAB_WORKHORSE_FOLDER} && cd -;
ls -al ${TMP_GITLAB_WORKHORSE_FOLDER};
rm -rf ${TMP_TEST_GITLAB_WORKHOSE_FOLDER};
# Move the temp folder to its final destination
mv ${TMP_GITLAB_WORKHORSE_FOLDER} ${TMP_TEST_FOLDER};
fi;
- source scripts/gitlab_workhorse_component_helpers.sh
- run_timed_command "download_gitlab_workhorse_package" || true
- run_timed_command "extract_gitlab_workhorse_package" || true
- run_timed_command "scripts/setup-test-env"
- run_timed_command "filter_gitlab_workhorse_binaries"
- echo -e "\e[0Ksection_start:`date +%s`:gitaly-test-build[collapsed=true]\r\e[0KCompiling Gitaly binaries"
- run_timed_command "scripts/gitaly-test-build" # Do not use 'bundle exec' here
- echo -e "\e[0Ksection_end:`date +%s`:gitaly-test-build\r\e[0K"
@@ -250,26 +232,18 @@ build-components:
- setup-test-env
- .rails:rules:build-components
script:
- source scripts/gitlab_workhorse_component_helpers.sh
- run_timed_command "download_gitlab_workhorse_package" || true
# Early exit if the package already exists
- gitlab_workhorse_archive_doesnt_exist || exit 0
- run_timed_command "scripts/setup-test-env"
- ls -al ${TMP_TEST_WORKHOSE_FOLDER}
- workhorse_tree=$(git rev-parse HEAD:workhorse)
- workhorse_binaries_file="workhorse-${workhorse_tree}.tar.gz"
- echo $workhorse_tree $workhorse_binaries_file
# Only keep the binaries in a temp folder
- mkdir -p "${TMP_GITLAB_WORKHORSE_FOLDER}"
- cd ${TMP_TEST_GITLAB_WORKHOSE_FOLDER} && cp ${GITLAB_WORKHORSE_PACKAGE_FILES} ${TMP_GITLAB_WORKHORSE_FOLDER} && cd -
- ls -al ${TMP_GITLAB_WORKHORSE_FOLDER}
- rm -rf ${TMP_TEST_GITLAB_WORKHOSE_FOLDER}
# Create the archive from the ${GITLAB_WORKHORSE_FOLDER} folder which contains the binaries
- tar -czvf ${workhorse_binaries_file} -C tmp ${GITLAB_WORKHORSE_FOLDER}
# Verify archive content
- tar -tvf ${workhorse_binaries_file}
# Upload the package
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${PACKAGENAME}.${VERSION}.tar.gz ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${workhorse}/${workhorse_tree}/${workhorse_binaries_file}'
- run_timed_command "filter_gitlab_workhorse_binaries"
- run_timed_command "create_gitlab_workhorse_archive"
- run_timed_command "upload_gitlab_workhorse_package"
artifacts:
expire_in: 7d
paths:
- ${TMP_GITLAB_WORKHORSE_FOLDER}
- ${TMP_TEST_GITLAB_WORKHOSE_FOLDER}/
update-setup-test-env-cache:
extends:
Loading