Skip to content
Snippets Groups Projects

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

All threads resolved!
Compare and Show latest version
1 file
+ 23
18
Compare changes
  • Side-by-side
  • Inline
@@ -193,9 +193,9 @@ 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_GITLAB_WORKHORSE_FOLDER: "${CI_PROJECT_DIR}/tmp/${GITLAB_WORKHORSE_FOLDER}"
TMP_TEST_FOLDER: "${CI_PROJECT_DIR}/tmp/tests"
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"
script:
@@ -203,21 +203,24 @@ setup-test-env:
- 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
- package_url="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${GITLAB_WORKHORSE_FOLDER}/${workhorse_tree}/${workhorse_package_file}"
- echo "Downloading from ${package_url} ..."
- 'wget --header="JOB-TOKEN: $CI_JOB_TOKEN" ${package_url} || 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
ls -l ${TMP_TEST_GITLAB_WORKHOSE_FOLDER};
fi;
- run_timed_command "scripts/setup-test-env"
# 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};
ls -l ${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;
- run_timed_command "scripts/setup-test-env"
# Move the temp folder to its final destination
- mv ${TMP_GITLAB_WORKHORSE_FOLDER} ${TMP_TEST_FOLDER};
- 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"
@@ -253,19 +256,21 @@ build-components:
- 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
- workhorse_package_file="workhorse-${workhorse_tree}.tar.gz"
- echo $workhorse_tree $workhorse_package_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}
- ls -l ${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}
- tar -czvf ${workhorse_package_file} -C tmp ${GITLAB_WORKHORSE_FOLDER}
# Verify archive content
- tar -tvf ${workhorse_binaries_file}
- tar -tvf ${workhorse_package_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}'
- package_url="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${GITLAB_WORKHORSE_FOLDER}/${workhorse_tree}/${workhorse_package_file}"
- echo "Uploading to ${package_url} ..."
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ${workhorse_package_file} ${package_url}'
artifacts:
expire_in: 7d
paths:
Loading