From 062e017b432dee5dcad018a8ddee1b093c059da6 Mon Sep 17 00:00:00 2001 From: JeGoi <13801368+JeGoi@users.noreply.github.com> Date: Mon, 12 Jun 2023 13:51:25 -0400 Subject: [PATCH] Change port 4 deployment --- .gitlab-ci.yml | 7 +++++++ ci/lib/upload/deploy-artifacts.sh | 25 +++++++++++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 277957d29355..710a1d5bc6c9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -422,6 +422,7 @@ variables: variables: DEPLOY_USER: reposync DEPLOY_HOST: web.inverse.ca + DEPLOY_PORT: 444 PPA_ID: ${CI_PIPELINE_ID} tags: - shell @@ -444,6 +445,7 @@ variables: variables: DEPLOY_USER: reposync DEPLOY_HOST: web.inverse.ca + DEPLOY_PORT: 444 script: - ./${UPLOAD_DIR}/deploy-artifacts.sh deb tags: @@ -456,6 +458,7 @@ variables: variables: DEPLOY_USER: reposync DEPLOY_HOST: web.inverse.ca + DEPLOY_PORT: 444 script: - ./${UPLOAD_DIR}/deploy-artifacts.sh deb tags: @@ -469,6 +472,7 @@ variables: DEPLOY_USER: reposync DEPLOY_HOST: web.inverse.ca DEPLOY_SRPMS: "no" + DEPLOY_PORT: 444 script: - ./${UPLOAD_DIR}/deploy-artifacts.sh rpm tags: @@ -482,6 +486,7 @@ variables: DEPLOY_USER: reposync DEPLOY_HOST: web.inverse.ca DEPLOY_SRPMS: "no" + DEPLOY_PORT: 444 script: - ./${UPLOAD_DIR}/deploy-artifacts.sh rpm tags: @@ -494,6 +499,7 @@ variables: variables: DEPLOY_USER: reposync DEPLOY_HOST: web.inverse.ca + DEPLOY_PORT: 444 script: - ./${UPLOAD_DIR}/deploy-artifacts.sh packetfence-release - ./${UPLOAD_DIR}/deploy-artifacts.sh packetfence-export @@ -509,6 +515,7 @@ variables: variables: DEPLOY_USER: reposync DEPLOY_HOST: web.inverse.ca + DEPLOY_PORT: 444 script: - ./${UPLOAD_DIR}/deploy-artifacts.sh website tags: diff --git a/ci/lib/upload/deploy-artifacts.sh b/ci/lib/upload/deploy-artifacts.sh index 8899bbbb2135..dd8595b21bd8 100755 --- a/ci/lib/upload/deploy-artifacts.sh +++ b/ci/lib/upload/deploy-artifacts.sh @@ -18,6 +18,7 @@ PUBLIC_DIR=${PUBLIC_DIR:-public} DEPLOY_USER=${DEPLOY_USER:-reposync} DEPLOY_HOST=${DEPLOY_HOST:-web.inverse.ca} +DEPLOY_PORT=${DEPLOY_PORT:-444} PUBLIC_REPO_BASE_DIR=${PUBLIC_REPO_BASE_DIR:-/var/www/inverse.ca/downloads/PacketFence} @@ -56,7 +57,7 @@ rpm_deploy() { # repodata dir will be created by createrepo command mkdir_cmd="$DEPLOY_USER@$DEPLOY_HOST mkdir -p $rpm_dir" echo "running following command: $mkdir_cmd" - ssh $mkdir_cmd \ + ssh -p $DEPLOY_PORT $mkdir_cmd \ || die "remote mkdir failed" if [ "$DEPLOY_SRPMS" == "no" ]; then @@ -68,13 +69,13 @@ rpm_deploy() { # copy rpm files echo "copy: $src_dir/*.rpm -> $dst_dir" - scp $src_dir/*.rpm $dst_dir \ + scp -P $DEPLOY_PORT $src_dir/*.rpm $dst_dir \ || die "scp failed" # update repository dst_cmd="$DEPLOY_USER@$DEPLOY_HOST $deploy_cmd" echo "running following command: $dst_cmd" - ssh $dst_cmd \ + ssh -p $DEPLOY_PORT $dst_cmd \ || die "update failed" done } @@ -90,18 +91,18 @@ deb_deploy() { # dest repo need to exist + conf directory mkdir_cmd="$DEPLOY_USER@$DEPLOY_HOST mkdir -p $dst_repo/conf" echo "running following command: $mkdir_cmd" - ssh $mkdir_cmd \ + ssh -p $DEPLOY_PORT $mkdir_cmd \ || die "remote mkdir failed" echo "copy: $src_dir/* -> $dst_dir" - scp $src_dir/* $dst_dir/ \ + scp -P $DEPLOY_PORT $src_dir/* $dst_dir/ \ || die "scp failed" deploy_cmd="/usr/local/bin/ci-repo-deploy deb $dst_repo $CI_ENV_NAME" dst_cmd="$DEPLOY_USER@$DEPLOY_HOST $deploy_cmd" extra_args="${release_name} ${changes_file}" echo "running following command: $dst_cmd $extra_args" - ssh $dst_cmd $extra_args \ + ssh -p $DEPLOY_PORT $dst_cmd $extra_args \ || die "update failed" done } @@ -117,7 +118,7 @@ packetfence_release_deploy() { declare -p src_dir dst_dir pf_release_rpm_file pkg_dest_name echo "scp: ${src_dir}/${pf_release_rpm_file} -> ${dst_dir}/${pkg_dest_name}" - scp "${src_dir}/${pf_release_rpm_file}" "${dst_dir}/${pkg_dest_name}" \ + scp -P $DEPLOY_PORT "${src_dir}/${pf_release_rpm_file}" "${dst_dir}/${pkg_dest_name}" \ || die "scp failed" done } @@ -134,7 +135,7 @@ packetfence_export_deploy() { declare -p src_dir dst_dir pf_export_rpm_file pf_export_rpm_dest_name echo "scp: ${src_dir}/${pf_export_rpm_file} -> ${dst_dir}/${pf_export_rpm_dest_name}" - scp "${src_dir}/${pf_export_rpm_file}" "${dst_dir}/${pf_export_rpm_dest_name}" \ + scp -P $DEPLOY_PORT "${src_dir}/${pf_export_rpm_file}" "${dst_dir}/${pf_export_rpm_dest_name}" \ || die "scp failed" done # Deb @@ -147,7 +148,7 @@ packetfence_export_deploy() { declare -p src_dir dst_dir pf_export_deb_file pf_export_deb_dest_name echo "scp: ${src_dir}/${pf_export_deb_file} -> ${dst_dir}/${pf_export_deb_dest_name}" - scp "${src_dir}/${pf_export_deb_file}" "${dst_dir}/${pf_export_deb_dest_name}" \ + scp -P $DEPLOY_PORT "${src_dir}/${pf_export_deb_file}" "${dst_dir}/${pf_export_deb_dest_name}" \ || die "scp failed" done } @@ -163,7 +164,7 @@ packetfence_ci_lib_deploy() { declare -p src_dir dst_dir pf_ci_lib_deb_file pf_ci_lib_deb_dest_name echo "scp: ${src_dir}/${pf_ci_lib_deb_file} -> ${dst_dir}/${pf_ci_lib_deb_dest_name}" - scp "${src_dir}/${pf_ci_lib_deb_file}" "${dst_dir}/${pf_ci_lib_deb_dest_name}" \ + scp -P $DEPLOY_PORT "${src_dir}/${pf_ci_lib_deb_file}" "${dst_dir}/${pf_ci_lib_deb_dest_name}" \ || die "scp failed" done } @@ -175,7 +176,7 @@ ppa_deploy() { dst_dir="$DEPLOY_USER@$DEPLOY_HOST:$dst_repo" declare -p src_dir dst_dir echo "rsync: $src_dir -> $dst_dir" - rsync -avz $src_dir $dst_dir \ + rsync -avz -e "ssh -p $DEPLOY_PORT" $src_dir $dst_dir \ || die "rsync failed" } @@ -187,7 +188,7 @@ website_deploy() { dst_dir="$DEPLOY_USER@$DEPLOY_HOST:$dst_repo" declare -p src_dir dst_dir echo "rsync: $src_dir -> $dst_dir" - rsync -avz $src_dir $dst_dir \ + rsync -avz -e "ssh -p $DEPLOY_PORT" $src_dir $dst_dir \ || die "rsync failed" }