From b4be07546ab3b31b68d2766f2e857f7b5b8788c6 Mon Sep 17 00:00:00 2001 From: Apoorv Bhawsar Date: Wed, 11 Aug 2021 17:04:10 +0530 Subject: [PATCH] chore: fix ant build --- .github/workflows/build.yaml | 8 ++- scripts/build.sh | 7 ++- scripts/ci.sh | 105 ----------------------------------- scripts/deploy.sh | 44 --------------- 4 files changed, 11 insertions(+), 153 deletions(-) delete mode 100755 scripts/ci.sh delete mode 100755 scripts/deploy.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ae371eab20fc..5064f6d23030 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -77,8 +77,10 @@ jobs: fi echo ::set-output name=BUILD_TAG::$(echo $tag) + - name: setup ant + run: mkdir -p /home/runner/.ant/lib ; ant ivy-bootstrap + - name: Build binaries - if: github.event_name == 'release' env: TAG: ${{ github.event.release.tag_name }} BUILD_TAG: ${{ steps.extract_tag.outputs.BUILD_TAG }} @@ -105,10 +107,10 @@ jobs: BUILD_TAG: ${{ steps.extract_tag.outputs.BUILD_TAG }} run: | cd $GITHUB_WORKSPACE - docker tag solr:$BUILD_TAG $ECR_URL/solr:$BUILD_TAG + docker tag solr:latest $ECR_URL/solr:$BUILD_TAG docker push $ECR_URL/solr:$BUILD_TAG if [ ! -z "$TAG" ]; then - docker tag solr:$BUILD_TAG $ECR_URL/solr:latest + docker tag solr:latest $ECR_URL/solr:latest docker push $ECR_URL/solr:latest fi diff --git a/scripts/build.sh b/scripts/build.sh index c08cc3e49be5..8fba393be7e0 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -9,7 +9,12 @@ echo "" PWD="$(pwd)" LUCENE_DIRECTORY="$PWD" SOLR_DIR="$PWD/solr" -SOLR_BASE_VERSION=${TRAVIS_TAG//v/} +SOLR_BASE_VERSION="" + +if [ -n "$TAG" ]; then + SOLR_BASE_VERSION=${BUILD_TAG//v/} +fi + # Echo For DEBUG echo "PWD: $PWD" diff --git a/scripts/ci.sh b/scripts/ci.sh deleted file mode 100755 index d16a31120788..000000000000 --- a/scripts/ci.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash - -# deploy.sh logs in ECR and pushes the image built - -latest="latest" - -if [ -z "$REGIONS" ]; then - REGIONS[0]='us-east-1' -fi - - -for reg in "${REGIONS[@]}"; do - echo "REGIONS: $reg" -done - -# Check if AWS command exists or not - -type aws > /dev/null 2>&1 || { - echo >&2 "AWS command not found.Aborting"; exit 1; -} - -if [ -z "$SERVICE_NAME" ]; then - echo >&2 "Service Name not set. Aborting"; exit 1; -fi -echo "SERVICE_NAME: $SERVICE_NAME" - -# login_ecr region -# Logs into ECR for a given region -login_ecr () { - if [ -z "$1" ]; then - echo >&2 "Incorrect Function Call. No Region Passed"; exit 1; - fi - - region=$1 - - echo "LOGIN to REGION: $region" - - eval $(aws ecr get-login --region $region --no-include-email); -} - - - -# push_to_aws region tag -# Pushes the docker image to ECR repo -push_to_aws () { - if [ -z "$1" ]; then - echo >&2 "Incorrect Function Call. No Region Passed"; exit 1; - fi - - if [ -z "$2" ]; then - echo >&2 "Incorrect Function Call. No Tag Passed"; exit 1; - fi - - - region=$1 - tag=$2 - - ecr_url=$(echo "${ECR_URL/REGION/$region}") - - echo "PUSHING DOCKER IMAGE" - echo "--------------------" - echo "REG: $reg" - echo "TAG: $tag" - echo "ECR: $ecr_url" - - docker tag $SERVICE_NAME:$latest $ecr_url/$SERVICE_NAME:$tag - - docker push $ecr_url/$SERVICE_NAME:$tag - - echo "DONE!!" - -} - -echo "TRAVIS: $TRAVIS" - -# Check if build is running on travis -if [ ! -z "$TRAVIS" ]; then - - # Login to ECR - for reg in "${REGIONS[@]}"; do - echo "FOR REGION: $reg" - echo "---------------------------------------------------------" - - login_ecr $reg - - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then - - push_to_aws $reg $latest - - if [ -n "$TRAVIS_TAG" ]; then - - push_to_aws $reg $TRAVIS_TAG - - fi - - else - - pr_tag="PR_$(echo "${TRAVIS_PULL_REQUEST_SLUG//\//_}")_$TRAVIS_PULL_REQUEST_BRANCH"; - - push_to_aws $reg $pr_tag - - fi - - done -fi diff --git a/scripts/deploy.sh b/scripts/deploy.sh deleted file mode 100755 index 2a91f5f121f4..000000000000 --- a/scripts/deploy.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# Vars -ROOT_DIRECTORY="$PWD" -MAVEN_SETTINGS="$PWD/.maven.settings.xml" -SOLR_BASE_VERSION=${TRAVIS_TAG//v/} - -# Echo For DEBUG -echo "PWD: $PWD" -echo "ROOT_DIRECTORY: $ROOT_DIRECTORY" -echo "MAVEN_SETTINGS: $MAVEN_SETTINGS" -echo "--------------------------------------------------------------------- " -echo "" - -# Check If the Maven settings exists -if [ ! -f $MAVEN_SETTINGS ]; then - echo "Maven Settings [$MAVEN_SETTINGS] doesn't exist. Aborting" - exit 1 -fi - -# Check if ant exists -type ant >/dev/null 2>&1 || { - echo >&2 "Ant doesn't exist. Aborting."; exit 1; -} - -# copy the maven settings to destination -cp $MAVEN_SETTINGS $HOME/.m2/settings.xml - -echo "--------------------------------------------------------------------- " - -if [ -n "$SOLR_BASE_VERSION" ]; then - echo "Deploying Maven artifacts for tagged build $TRAVIS_TAG" - ant clean -Dversion=$SOLR_BASE_VERSION -Dm2.repository.id=github \ - -Dm2.repository.url=https://maven.pkg.github.com/unbxd/artifacts \ - generate-maven-artifacts -else - echo "Deploying Maven artifacts for non-tagged build(snapshots)" - ant clean -Dm2.repository.id=github \ - -Dm2.repository.url=https://maven.pkg.github.com/unbxd/artifacts \ - generate-maven-artifacts -fi - -echo "--------------------------------------------------------------------- " -echo ""