cimbalek commented on code in PR #1202: URL: https://github.com/apache/incubator-kie-kogito-pipelines/pull/1202#discussion_r1611306319
########## .ci/jenkins/scripts/bash/zip-sources-all.sh: ########## @@ -0,0 +1,145 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +### MANDATORY VARIABLES DEFINITION - UNCOMMENT FOR LOCAL USE ### +### In Jenkins these VARIABLES are set as jenkins job parameters ### + +#VERSION="10.0.0" +#BRANCH_DEFAULT="main" +# Configuration in format "repository-id;repository_name;branch(if-override-needed)" +# - eg.not all repositories have main branch +#REPOS="drools-repo;incubator-kie-drools +#kogito-runtimes-repo;incubator-kie-kogito-runtimes +#kogito-apps-repo;incubator-kie-kogito-apps +#kogito-images-repo;incubator-kie-kogito-images +#optaplanner-repo;incubator-kie-optaplanner +#kogito-serverless-operator-repo;incubator-kie-kogito-serverless-operator +#optaplanner-quickstarts-repo;incubator-kie-optaplanner-quickstarts;stable +#kogito-examples-repo;incubator-kie-kogito-examples +#kie-tools-repo;incubator-kie-tools +#kie-sandbox-quarkus-accelerator-repo;incubator-kie-sandbox-quarkus-accelerator +#kogito-online-repo;incubator-kie-kogito-online" + +function zip_sources() { + SOURCES_DIRECTORY_NAME="sources" + REPO_ORGANIZATION="apache" + + while read line; do + BRANCH=${BRANCH_DEFAULT} + #get rid of carriage return character if present + line="$(echo $line | sed 's#\r##g')" + + #Clone + echo "Clone $( echo $line | awk -F';' '{ print $1 }' | sed 's\-repo\\g' )" + REPO_NAME=$( echo $line | awk -F';' '{print $2 }' ) + REPO_DIRECTORY=${SOURCES_DIRECTORY_NAME}/${REPO_NAME} + REPO_BRANCH=$( echo $line | awk -F';' '{print $3}' ) + if [[ ! -z ${REPO_BRANCH} ]]; then + BRANCH=$REPO_BRANCH + fi + git clone --branch ${BRANCH} --depth 1 "https://github.com/${REPO_ORGANIZATION}/${REPO_NAME}.git" ${REPO_DIRECTORY} + STATE=$? + if [[ ${STATE} != 0 ]]; then + echo "Clonning of ${REPO_NAME} was NOT successfull. Failing" + exit 1 + fi + # clone_repository ${REPO_NAME} ${REPO_ORGANIZATION} ${BRANCH} ${REPO_DIRECTORY} + + #Remove unnecessary dirs + pushd $REPO_DIRECTORY + CURRENT_DIRECTORY=$(pwd) + echo "Current directory is ${CURRENT_DIRECTORY}" + echo "Before .git removal" + ls -lha + echo "Searching for .git directory" + if [[ -d '.git' ]]; then + echo ".git directory found, deleting..." + rm -rf ".git" + fi + echo "After .git removal" + ls -lha + popd + + #Creating ZIP + pushd ${SOURCES_DIRECTORY_NAME} + ZIP_FILE_NAME="${REPO_NAME}-sources-${VERSION}.zip" Review Comment: I'll adjust the list. I had the script long done already by the time jenkinsfile got to me. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
