From 3e11f03679a0a659383ec3bd1160c0e96854065e Mon Sep 17 00:00:00 2001 From: luwenpeng Date: Fri, 11 Feb 2022 16:14:39 +0800 Subject: 优化TFE加壳的流程 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 92 +++++++++++++++++----------------------------- ci/envelope_rpm.sh | 11 ++++++ ci/upload_enveloped_rpm.sh | 21 +++++++++++ 3 files changed, 65 insertions(+), 59 deletions(-) create mode 100644 ci/envelope_rpm.sh create mode 100644 ci/upload_enveloped_rpm.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a48688..3164145 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -42,38 +42,6 @@ stages: tags: - share -.envelope_rpm_script: - stage: envelope - script: - - ls $CI_PROJECT_DIR/build/*.rpm - - echo $TARGET_SYS_TYPE - - export RPM_FULL_PATH=`ls $CI_PROJECT_DIR/build/*.rpm | grep -v debug | grep -v devel | grep $TARGET_SYS_TYPE | head -n 1` - - echo $RPM_FULL_PATH - - export BIN_TO_PROTECT_IN_RPM="${INSTALL_PREFIX}/bin/tfe" - - /root/rebuildrpm_and_envelope.sh $RPM_FULL_PATH $BIN_TO_PROTECT_IN_RPM $FEATURE_ID $APP_NAME_IN_RPM_SPEC - tags: - - envelope - artifacts: - name: "tfe-pr-$CI_COMMIT_REF_NAME-release" - paths: - - build/*-pr-*.rpm - only: - - tags - -.upload_enveloped_rpm_script: - stage: upload - script: - - cd $CI_PROJECT_DIR/build/ - - ls -ahl *.rpm - - echo $TARGET_SYS_TYPE - - cp ~/rpm_upload_tools.py ./ - - python3 rpm_upload_tools.py ${PULP3_REPO_NAME} ${PULP3_DIST_NAME} *-pr-*${TARGET_SYS_TYPE}*.rpm - - rm -rf *.rpm - tags: - - share - only: - - tags - ############################################################################### # compile use image: build-env:master ############################################################################### @@ -162,22 +130,6 @@ release_build_release_for_centos7: only: - tags -envelope_rpm_for_centos7: - image: $BUILD_IMAGE_CENTOS7 - variables: - FEATURE_ID: 100 - APP_NAME_IN_RPM_SPEC: tfe - TARGET_SYS_TYPE: el7 - extends: .envelope_rpm_script - -upload_enveloped_rpm_for_centos7: - image: $BUILD_IMAGE_CENTOS7 - variables: - TARGET_SYS_TYPE: el7 - PULP3_REPO_NAME: tfe-stable-x86_64.el7 - PULP3_DIST_NAME: tfe-stable-x86_64.el7 - extends: .upload_enveloped_rpm_script - ############################################################################### # compile use image: build-env:rockylinux ############################################################################### @@ -266,18 +218,40 @@ release_build_release_for_centos8: only: - tags -envelope_rpm_for_centos8: - image: $BUILD_IMAGE_CENTOS8 +############################################################################### +# envelope and upload +############################################################################### + +envelope_rpm: + stage: envelope + image: $BUILD_IMAGE_CENTOS7 variables: FEATURE_ID: 100 APP_NAME_IN_RPM_SPEC: tfe - TARGET_SYS_TYPE: el8 - extends: .envelope_rpm_script - -upload_enveloped_rpm_for_centos8: - image: $BUILD_IMAGE_CENTOS8 + script: + - chmod +x ./ci/envelope_rpm.sh + - ./ci/envelope_rpm.sh + artifacts: + name: "tfe-pr-$CI_COMMIT_REF_NAME-release" + paths: + - build/*-pr-*.rpm + tags: + - envelope + only: + - tags + +upload_enveloped_rpm: + stage: upload + image: $BUILD_IMAGE_CENTOS7 variables: - TARGET_SYS_TYPE: el8 - PULP3_REPO_NAME: tfe-stable-x86_64.el8 - PULP3_DIST_NAME: tfe-stable-x86_64.el8 - extends: .upload_enveloped_rpm_script \ No newline at end of file + PULP3_REPO_NAME_EL7: tfe-stable-x86_64.el7 + PULP3_DIST_NAME_EL7: tfe-stable-x86_64.el7 + PULP3_REPO_NAME_EL8: tfe-stable-x86_64.el8 + PULP3_DIST_NAME_EL8: tfe-stable-x86_64.el8 + script: + - chmod +x ./ci/upload_enveloped_rpm.sh + - ./ci/upload_enveloped_rpm.sh + tags: + - share + only: + - tags \ No newline at end of file diff --git a/ci/envelope_rpm.sh b/ci/envelope_rpm.sh new file mode 100644 index 0000000..78ee452 --- /dev/null +++ b/ci/envelope_rpm.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +ls $CI_PROJECT_DIR/build/*.rpm + +BIN_TO_PROTECT_IN_RPM="${INSTALL_PREFIX}/bin/tfe" +RPMS_FULL_PATH=`ls $CI_PROJECT_DIR/build/*.rpm | grep -v debug | grep -v devel` + +for RPMS_FULL_PATH in ${RPM[@]} +do + /root/rebuildrpm_and_envelope.sh $RPM $BIN_TO_PROTECT_IN_RPM $FEATURE_ID $APP_NAME_IN_RPM_SPEC +done \ No newline at end of file diff --git a/ci/upload_enveloped_rpm.sh b/ci/upload_enveloped_rpm.sh new file mode 100644 index 0000000..4ca6e4f --- /dev/null +++ b/ci/upload_enveloped_rpm.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env sh + +cd $CI_PROJECT_DIR/build/ +cp ~/rpm_upload_tools.py ./ + +ls -ahl *.rpm + +RPM_IS_EL7=`ls -ahl *-pr-*.rpm | grep el7 | wc -l` +RPM_IS_EL8=`ls -ahl *-pr-*.rpm | grep el8 | wc -l` + +if [ $RPM_IS_EL7 -eq 1 ] +then + python3 rpm_upload_tools.py ${PULP3_REPO_NAME_EL7} ${PULP3_DIST_NAME_EL7} *-pr-*el7*.rpm +fi + +if [ $RPM_IS_EL8 -eq 1 ] +then + python3 rpm_upload_tools.py ${PULP3_REPO_NAME_EL8} ${PULP3_DIST_NAME_EL8} *-pr-*el8*.rpm +fi + +rm -rf *.rpm \ No newline at end of file -- cgit v1.2.3