Loading .gitlab-ci.yml +64 −7 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ stages: - 1_setup - 2_lint - 3_build - 4_test - 4_validate - 5_release - 6_cleanup - 7_publish Loading Loading @@ -179,6 +179,62 @@ job_rpmbuild: - { when: always } job_tag_validate: stage: 4_validate allow_failure: false tags: [ acme-conda-stage.sns.gov ] script: - pwd - | ls -lah ./rpmbuild ls -lah ./rpmbuild/RPMS/noarch ls -lah ./rpmbuild/SOURCES ls -lah ./rpmbuild/SRPMS # Use the rpm utils inside the readybake_rpmbuild container to retrieve # the package version from the RPM that was generated during stage 3 - test $(find ./rpmbuild/RPMS/ -name "*.rpm" | wc -l) -eq 1 - read -r rpm_file <<< $(find ./rpmbuild/RPMS/ -name "*.rpm") - read -r container_id <<< $(docker create --rm --tty readybake_rpmbuild:latest rpm --query --queryformat='%{version}\n' ${rpm_file}) - docker cp ./rpmbuild ${container_id}:/home/hardhat # read stdout from the container, strip all newlines, carriage returns, tabs, spaces # and store it in pkg_version variable - read -r pkg_version <<< $(docker start --attach ${container_id} | tr -d '\r\n\t ') #- | # if [[ "${CI_COMMIT_REF_NAME}" == "${CI_DEFAULT_BRANCH}" ]]; then # tag_release="v${pkg_version}" # else # tag_release="v${pkg_version}-$(date +'%Y%m%d')-${CI_COMMIT_REF_NAME}" # fi - tag_release="v${pkg_version}" - tag_list="$(git tag -l | tr '\r\n\t' ' ')" - | echo . echo . echo "nsd-app-wrap validate release tag >> [Info] << git_branch: ${CI_COMMIT_REF_NAME}" echo . echo . echo "nsd-app-wrap validate release tag >> [Info] << git tag -l" echo "${tag_list}" | tr ' ' '\n' echo . echo . echo "nsd-app-wrap validate release tag >> [Info] << tag_release: ${tag_release}" | cat -v echo . echo . # Tag is determined from the rpm spec file. If the version already exists, then error_exit - | if echo -n "${tag_list}" | grep -F -q -w "${tag_release}" ; then echo "nsd-app-wrap validate release tag >> [Error] << tag already exists: ${tag_release}" exit 1 fi echo . echo . needs: - { job: job_rpmbuild } rules: - { when: always } job_tag_release: stage: 5_release allow_failure: false Loading Loading @@ -234,12 +290,13 @@ job_tag_release: # read stdout from the container, strip all newlines, carriage returns, tabs, spaces # and store it in pkg_version variable - read -r pkg_version <<< $(docker start --attach ${container_id} | tr -d '\r\n\t ') - | if [[ "${CI_COMMIT_REF_NAME}" == "${CI_DEFAULT_BRANCH}" ]]; then tag_release="v${pkg_version}" else tag_release="v${pkg_version}-$(date +'%Y%m%d')-${CI_COMMIT_REF_NAME}" fi #- | # if [[ "${CI_COMMIT_REF_NAME}" == "${CI_DEFAULT_BRANCH}" ]]; then # tag_release="v${pkg_version}" # else # tag_release="v${pkg_version}-$(date +'%Y%m%d')-${CI_COMMIT_REF_NAME}" # fi - tag_release="v${pkg_version}" - tag_list="$(git tag -l | tr '\r\n\t' ' ')" - | echo . Loading Loading
.gitlab-ci.yml +64 −7 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ stages: - 1_setup - 2_lint - 3_build - 4_test - 4_validate - 5_release - 6_cleanup - 7_publish Loading Loading @@ -179,6 +179,62 @@ job_rpmbuild: - { when: always } job_tag_validate: stage: 4_validate allow_failure: false tags: [ acme-conda-stage.sns.gov ] script: - pwd - | ls -lah ./rpmbuild ls -lah ./rpmbuild/RPMS/noarch ls -lah ./rpmbuild/SOURCES ls -lah ./rpmbuild/SRPMS # Use the rpm utils inside the readybake_rpmbuild container to retrieve # the package version from the RPM that was generated during stage 3 - test $(find ./rpmbuild/RPMS/ -name "*.rpm" | wc -l) -eq 1 - read -r rpm_file <<< $(find ./rpmbuild/RPMS/ -name "*.rpm") - read -r container_id <<< $(docker create --rm --tty readybake_rpmbuild:latest rpm --query --queryformat='%{version}\n' ${rpm_file}) - docker cp ./rpmbuild ${container_id}:/home/hardhat # read stdout from the container, strip all newlines, carriage returns, tabs, spaces # and store it in pkg_version variable - read -r pkg_version <<< $(docker start --attach ${container_id} | tr -d '\r\n\t ') #- | # if [[ "${CI_COMMIT_REF_NAME}" == "${CI_DEFAULT_BRANCH}" ]]; then # tag_release="v${pkg_version}" # else # tag_release="v${pkg_version}-$(date +'%Y%m%d')-${CI_COMMIT_REF_NAME}" # fi - tag_release="v${pkg_version}" - tag_list="$(git tag -l | tr '\r\n\t' ' ')" - | echo . echo . echo "nsd-app-wrap validate release tag >> [Info] << git_branch: ${CI_COMMIT_REF_NAME}" echo . echo . echo "nsd-app-wrap validate release tag >> [Info] << git tag -l" echo "${tag_list}" | tr ' ' '\n' echo . echo . echo "nsd-app-wrap validate release tag >> [Info] << tag_release: ${tag_release}" | cat -v echo . echo . # Tag is determined from the rpm spec file. If the version already exists, then error_exit - | if echo -n "${tag_list}" | grep -F -q -w "${tag_release}" ; then echo "nsd-app-wrap validate release tag >> [Error] << tag already exists: ${tag_release}" exit 1 fi echo . echo . needs: - { job: job_rpmbuild } rules: - { when: always } job_tag_release: stage: 5_release allow_failure: false Loading Loading @@ -234,12 +290,13 @@ job_tag_release: # read stdout from the container, strip all newlines, carriage returns, tabs, spaces # and store it in pkg_version variable - read -r pkg_version <<< $(docker start --attach ${container_id} | tr -d '\r\n\t ') - | if [[ "${CI_COMMIT_REF_NAME}" == "${CI_DEFAULT_BRANCH}" ]]; then tag_release="v${pkg_version}" else tag_release="v${pkg_version}-$(date +'%Y%m%d')-${CI_COMMIT_REF_NAME}" fi #- | # if [[ "${CI_COMMIT_REF_NAME}" == "${CI_DEFAULT_BRANCH}" ]]; then # tag_release="v${pkg_version}" # else # tag_release="v${pkg_version}-$(date +'%Y%m%d')-${CI_COMMIT_REF_NAME}" # fi - tag_release="v${pkg_version}" - tag_list="$(git tag -l | tr '\r\n\t' ' ')" - | echo . Loading