From fd69f34e47f189f6e36ed9973709ca0be5f90120 Mon Sep 17 00:00:00 2001 From: Arnstein Ressem Date: Wed, 28 Aug 2024 11:23:32 +0200 Subject: [PATCH] Delete unused scripts after migration to Buildkite. --- screwdriver.yaml | 300 ------------------ screwdriver/build-vespa.sh | 74 ----- .../delete-old-artifactory-artifacts.sh | 47 --- screwdriver/detect-what-to-build.sh | 37 --- screwdriver/factory-command.sh | 91 ------ ...publish-unpublished-rpms-to-jfrog-cloud.sh | 77 ----- screwdriver/release-container-image-docker.sh | 89 ------ screwdriver/release-container-image.sh | 85 ----- screwdriver/release-rpms.sh | 66 ---- screwdriver/trig-buildkite-pipeline.sh | 27 -- 10 files changed, 893 deletions(-) delete mode 100644 screwdriver.yaml delete mode 100755 screwdriver/build-vespa.sh delete mode 100755 screwdriver/delete-old-artifactory-artifacts.sh delete mode 100755 screwdriver/detect-what-to-build.sh delete mode 100755 screwdriver/factory-command.sh delete mode 100755 screwdriver/publish-unpublished-rpms-to-jfrog-cloud.sh delete mode 100755 screwdriver/release-container-image-docker.sh delete mode 100755 screwdriver/release-container-image.sh delete mode 100755 screwdriver/release-rpms.sh delete mode 100755 screwdriver/trig-buildkite-pipeline.sh diff --git a/screwdriver.yaml b/screwdriver.yaml deleted file mode 100644 index 44f404b40307..000000000000 --- a/screwdriver.yaml +++ /dev/null @@ -1,300 +0,0 @@ -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. ---- -shared: - image: docker.io/vespaengine/vespa-build-almalinux-8 - environment: - USER_SHELL_BIN: bash - annotations: - screwdriver.cd/restrictPR: fork - restore-cache: &restore-cache - restore-cache: | - (cd /tmp && if [[ -f $MAIN_CACHE_FILE ]]; then tar xf $MAIN_CACHE_FILE; fi) - - mkdir -p $CCACHE_DATA_DIR - mkdir -p $CCACHE_TMP_DIR - - export CCACHE_DIR=$CCACHE_DATA_DIR - - rm -f $CCACHE_DIR/ccache.conf - ccache -M 20G - ccache -o log_file=$SD_ARTIFACTS_DIR/ccache_log.txt - ccache -o temporary_dir=$CCACHE_TMP_DIR - ccache -p - ccache -z - du -sh /tmp/* - - save-cache: &save-cache - save-cache: | - ls -lart /tmp/vespa - du -sh /tmp/vespa/* - - if [[ -z "$SD_PULL_REQUEST" ]]; then - if [[ -z "$VESPA_USE_SANITIZER" ]] || [[ "$VESPA_USE_SANITIZER" == null ]]; then - # Remove what we have produced - rm -rf $LOCAL_MVN_REPO/com/yahoo - rm -rf $LOCAL_MVN_REPO/ai/vespa - - # Tar toghether the /tmp/vespa folder containing ccache and cleaned mvn repo - mkdir -p $(dirname $MAIN_CACHE_FILE) - (cd /tmp && tar cf $MAIN_CACHE_FILE vespa) - - # Wipe the cache if we exceed 2GB to avoid pulling and pusing too large files - if (( $(stat --format='%s' $MAIN_CACHE_FILE) > $(( 2500*1000*1000 )) )); then - tar cf $MAIN_CACHE_FILE --files-from=/dev/null; - echo "Cleaning cache file. $MAIN_CACHE_FILE is now $(stat --format='%s' $MAIN_CACHE_FILE) bytes." - fi - fi - fi - -jobs: - publish-release: - annotations: - screwdriver.cd/cpu: 7 - screwdriver.cd/ram: 16 - screwdriver.cd/disk: HIGH - screwdriver.cd/timeout: 300 - screwdriver.cd/dockerEnabled: true - screwdriver.cd/dockerCpu: TURBO - screwdriver.cd/dockerRam: HIGH - - screwdriver.cd/buildPeriodically: H 4,10,16,22 * * 1,2,3,4 - - secrets: - - BUILDKITE_TRIGGER_TOKEN - - COPR_WEBHOOK - - OSSRH_USER - - OSSRH_TOKEN - - GPG_KEYNAME - - GPG_PASSPHRASE - - GPG_ENCPHRASE - - SAMPLE_APPS_DEPLOY_KEY - - VESPA_DEPLOY_KEY - - DOCKER_IMAGE_DEPLOY_KEY - - DOCKER_HUB_DEPLOY_KEY - - GHCR_DEPLOY_KEY - - ANN_BENCHMARK_DEPLOY_KEY - - SVC_OKTA_VESPA_FACTORY_TOKEN - - environment: - GIT_SSH_COMMAND: "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" - - steps: - - get-vespa-version: | - JSON=$(screwdriver/factory-command.sh create-release) - VESPA_VERSION=$(jq -re '.version' <<< "$JSON") - JSON=$(screwdriver/factory-command.sh get-version $VESPA_VERSION) - VESPA_REF=$(jq -re '.commits|.[]|select(.repo=="vespa")|.ref' <<< "$JSON") - echo "VESPA_VERSION=$VESPA_VERSION VESPA_REF=$VESPA_REF" - if [[ $VESPA_VERSION == null ]] || [[ $VESPA_REF == null ]]; then - echo "Must have valid Vespa version and reference to continue (got VESPA_VERSION=$VESPA_VERSION, VESPA_REF=$VESPA_REF)." - return 1 - fi - meta set vespa.version $VESPA_VERSION - - trig-buildkite: | - BUILDKITE_JSON=$(screwdriver/trig-buildkite-pipeline.sh vespa-engine-vespa-release master $VESPA_VERSION $VESPA_REF "Releasing open-source Vespa version $VESPA_VERSION :rocket:") - - wait-for-buildkite: | - BUILDKITE_URL=$(jq -re '.url' <<< "$BUILDKITE_JSON") - BUILDKITE_WEB_URL=$(jq -re '.web_url' <<< "$BUILDKITE_JSON") - screwdriver/wait-for-buildkite-build.sh $BUILDKITE_URL $BUILDKITE_WEB_URL 1800 - - update-released-time: | - screwdriver/factory-command.sh update-released-time $VESPA_VERSION - - publish-legacy-release: - annotations: - screwdriver.cd/cpu: 7 - screwdriver.cd/ram: 16 - screwdriver.cd/disk: HIGH - screwdriver.cd/timeout: 300 - screwdriver.cd/dockerEnabled: true - screwdriver.cd/dockerCpu: TURBO - screwdriver.cd/dockerRam: HIGH - screwdriver.cd/buildPeriodically: H 6 1 * * - - environment: - IMAGE_NAME: "vespaengine/vespa-generic-intel-x86_64" - - secrets: - - DOCKER_HUB_DEPLOY_KEY - - steps: - - get-vespa-version: | - set -x - VESPA_VERSION=$(meta get vespa.version --external publish-release) - if [[ $VESPA_VERSION == null ]] || [[ $VESPA_REF == null ]]; then - echo "Must have valid Vespa version to continue (got VESPA_VERSION=$VESPA_VERSION)." - return 1 - fi - - install-dependencies: | - dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo - dnf install -y docker-ce docker-ce-cli containerd.io python3 python3-pip - docker system info - - checkout: | - mkdir -p workdir - cd workdir - export WORKDIR=$(pwd) - git clone -q https://github.com/vespa-engine/vespa - (cd vespa && git checkout v$VESPA_VERSION) - git clone -q https://github.com/vespa-engine/system-test - # Set correct version in pom.xml files - (cd vespa && screwdriver/replace-vespa-version-in-poms.sh $VESPA_VERSION $(pwd) ) - - build-rpms: | - cd $WORKDIR - make -C $WORKDIR/vespa -f .copr/Makefile srpm outdir=$WORKDIR - rpmbuild --rebuild \ - --define="_topdir $WORKDIR/vespa-rpmbuild" \ - --define "debug_package %{nil}" \ - --define "_debugsource_template %{nil}" \ - --define '_cmake_extra_opts "-DDEFAULT_VESPA_CPU_ARCH_FLAGS=-msse3 -mcx16 -mtune=intel"' \ - *.src.rpm - rm -f *.src.rpm - mv $WORKDIR/vespa-rpmbuild/RPMS/x86_64/*.rpm . - - build-container-image: | - cat < Dockerfile - ARG VESPA_VERSION - FROM docker.io/vespaengine/vespa:\$VESPA_VERSION - USER root - RUN --mount=type=bind,target=/rpms/,source=. dnf reinstall -y /rpms/vespa*rpm && dnf clean all - USER vespa - EOF - docker build --progress plain --build-arg VESPA_VERSION=$VESPA_VERSION --tag docker.io/$IMAGE_NAME:$VESPA_VERSION \ - --tag docker.io/$IMAGE_NAME:latest --file Dockerfile . - - verify-container-image: | - # Trick to be able to use the documentation testing to verify the image built locally - docker tag docker.io/$IMAGE_NAME:$VESPA_VERSION vespaengine/vespa:latest - # Run quick start guide - $SD_SOURCE_DIR/screwdriver/test-quick-start-guide.sh - - publish-image: | - if [[ -z $SD_PULL_REQUEST ]]; then - if curl -fsSL https://hub.docker.com/v2/repositories/$IMAGE_NAME/tags/$VESPA_VERSION/ &> /dev/null; then - echo "Container image docker.io/$IMAGE_NAME:$VESPA_VERSION aldready exists." - else - OPT_STATE="$(set +o)" - set +x - docker login --username aressem --password "$DOCKER_HUB_DEPLOY_KEY" - eval "$OPT_STATE" - docker push docker.io/$IMAGE_NAME:$VESPA_VERSION - docker push docker.io/$IMAGE_NAME:latest - fi - fi - - publish-el9-preview: - annotations: - screwdriver.cd/cpu: 7 - screwdriver.cd/ram: 16 - screwdriver.cd/disk: HIGH - screwdriver.cd/timeout: 300 - screwdriver.cd/dockerEnabled: true - screwdriver.cd/dockerCpu: TURBO - screwdriver.cd/dockerRam: HIGH - screwdriver.cd/buildPeriodically: H 6 1 * * - - environment: - BASE_IMAGE: "el9" - IMAGE_NAME: "vespaengine/vespa-el9-preview" - - secrets: - - DOCKER_HUB_DEPLOY_KEY - - steps: &publish-el9-preview-steps - - get-vespa-version: | - set -x - VESPA_VERSION=$(meta get vespa.version --external publish-release) - if [[ $VESPA_VERSION == null ]] || [[ $VESPA_REF == null ]]; then - echo "Must have valid Vespa version to continue (got VESPA_VERSION=$VESPA_VERSION)." - return 1 - fi - VESPA_MAJOR=$(echo $VESPA_VERSION | cut -d. -f1) - - install-dependencies: | - dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo - dnf -y install docker-ce docker-ce-cli containerd.io python3 python3-pip - docker system info - - checkout: | - git clone https://github.com/vespa-engine/docker-image - cd docker-image - - build-container-image: | - docker buildx install - unset DOCKER_HOST - docker context create vespa-context --docker "host=tcp://localhost:2376,ca=/certs/client/ca.pem,cert=/certs/client/cert.pem,key=/certs/client/key.pem" - docker context use vespa-context - docker buildx create --name vespa-builder --driver docker-container --use - docker buildx inspect --bootstrap - docker buildx build \ - --progress plain \ - --load \ - --platform linux/amd64 \ - --build-arg VESPA_BASE_IMAGE=$BASE_IMAGE \ - --build-arg VESPA_VERSION=$VESPA_VERSION \ - --file Dockerfile \ - --tag docker.io/vespaengine/vespa:latest \ - --tag docker.io/$IMAGE_NAME:latest \ - . - - verify-container-image: | - # Run quick start guide - $SD_SOURCE_DIR/screwdriver/test-quick-start-guide.sh - - publish-image: | - if [[ -z $SD_PULL_REQUEST ]]; then - if curl -fsSL https://hub.docker.com/v2/repositories/$IMAGE_NAME/tags/$VESPA_VERSION/ &> /dev/null; then - echo "Container image docker.io/$IMAGE_NAME:$VESPA_VERSION aldready exists." - else - OPT_STATE="$(set +o)" - set +x - docker login --username aressem --password "$DOCKER_HUB_DEPLOY_KEY" - eval "$OPT_STATE" - docker buildx build \ - --progress plain \ - --push \ - --platform linux/amd64,linux/arm64 \ - --build-arg VESPA_BASE_IMAGE=$BASE_IMAGE \ - --build-arg VESPA_VERSION=$VESPA_VERSION \ - --file Dockerfile \ - --tag docker.io/$IMAGE_NAME:$VESPA_VERSION \ - --tag docker.io/$IMAGE_NAME:$VESPA_MAJOR \ - --tag docker.io/$IMAGE_NAME:latest \ - . - fi - fi - - verify-opensource-release-7days: - annotations: - screwdriver.cd/buildPeriodically: H 0 * * * - steps: - - now-epoch: | - now_epoch=`date "+%s"` - echo "Now epoch: " $now_epoch - - calculate-current-release-age: | - current_release_date=$(curl -sLf https://repo1.maven.org/maven2/com/yahoo/vespa/cloud-tenant-base/maven-metadata.xml | \ - grep -oP "\K\w+" | cut -c 1-8) - echo "Current release date: " $current_release_date - current_release_epoch=`date -d "$current_release_date" "+%s"` - echo "Current release epoch: " $current_release_epoch - release_age_days=$((($now_epoch-$current_release_epoch)/86400)) - echo "Release age days: " $release_age_days - - error-if-current-release-too-old: | - if [ "$release_age_days" -gt 7 ]; then - echo "Current open source release is older than 7 days" - exit 1 - fi - - calculate-docker-image-age: | - image_date=$(curl -sLf https://hub.docker.com/v2/repositories/vespaengine/vespa/ | jq -re '.last_updated') - echo "Docker image last_updated: " $image_date - image_epoch=`date -d "$image_date" "+%s"` - echo "Docker image epoch: " $image_epoch - docker_image_age_days=$((($now_epoch-$image_epoch)/86400)) - echo "Docker image age days: " $docker_image_age_days - - error-if-docker-image-too-old: | - if [ "$docker_image_age_days" -gt 7 ]; then - echo "Current Docker image is older than 7 days" - exit 1 - fi - - delete-old-versions-in-archive: - annotations: - screwdriver.cd/cpu: LOW - screwdriver.cd/ram: LOW - screwdriver.cd/timeout: 10 - screwdriver.cd/buildPeriodically: H 6 * * * - secrets: - - CLOUDSMITH_API_TOKEN - steps: - - cleanup: | - screwdriver/delete-old-cloudsmith-artifacts.sh diff --git a/screwdriver/build-vespa.sh b/screwdriver/build-vespa.sh deleted file mode 100755 index 7036a9ba7b2b..000000000000 --- a/screwdriver/build-vespa.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -set -e - -readonly SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd )" -readonly NUM_THREADS=$(( $(nproc) + 2 )) - -source /etc/profile.d/enable-gcc-toolset.sh - -export MALLOC_ARENA_MAX=1 -export MAVEN_OPTS="-Xss1m -Xms128m -Xmx2g" -export VESPA_MAVEN_EXTRA_OPTS="${VESPA_MAVEN_EXTRA_OPTS:+${VESPA_MAVEN_EXTRA_OPTS} }--no-snapshot-updates --batch-mode --threads ${NUM_THREADS}" - -ccache --max-size=20G -ccache --set-config=compression=true -ccache -p - -if ! source $SOURCE_DIR/screwdriver/detect-what-to-build.sh; then - echo "Could not detect what to build." - SHOULD_BUILD=systemtest -fi - -build_cpp() { - cat /proc/cpuinfo | grep "model name" | head -1 - cat /proc/cpuinfo | grep "flags" | head -1 - cmake3 -DVESPA_UNPRIVILEGED=no $1 - time make -j ${NUM_THREADS} - time ctest3 --output-on-failure -j ${NUM_THREADS} - ccache --show-stats -} - -echo "Building: $SHOULD_BUILD" - -cd ${SOURCE_DIR} - -case $SHOULD_BUILD in - cpp) - ./bootstrap.sh full - build_cpp . - ;; - java) - ./bootstrap.sh java - ./mvnw -V $VESPA_MAVEN_EXTRA_OPTS install - ;; - go) - make -C client/go install-all - ;; - *) - make -C client/go install-all - ./bootstrap.sh java - time ./mvnw -V $VESPA_MAVEN_EXTRA_OPTS install - build_cpp . - make install - ;; -esac - -if [[ $SHOULD_BUILD == systemtest ]]; then - cd $HOME - git clone https://github.com/vespa-engine/system-test - export SYSTEM_TEST_DIR=$(pwd)/system-test - export RUBYLIB="$SYSTEM_TEST_DIR/lib:$SYSTEM_TEST_DIR/tests" - useradd vespa - - # Workaround for /opt/vespa/tmp directory created by systemtest runner - mkdir -p /opt/vespa/tmp - chmod 1777 /opt/vespa/tmp - - export USER=vespa - $SYSTEM_TEST_DIR/lib/node_server.rb & - NODE_SERVER_PID=$! - sleep 3 - ruby $SYSTEM_TEST_DIR/tests/search/basicsearch/basic_search.rb || (/opt/vespa/bin/vespa-logfmt -N && false) -fi diff --git a/screwdriver/delete-old-artifactory-artifacts.sh b/screwdriver/delete-old-artifactory-artifacts.sh deleted file mode 100755 index 3167f91accb2..000000000000 --- a/screwdriver/delete-old-artifactory-artifacts.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - - -set -euo pipefail - -MAX_NUMBER_OF_RELEASES=200 -ARTIFACTORY_URL="https://artifactory.yahooinc.com/artifactory" - -# JFrog Cloud repo file -if [[ ! -f /etc/yum.repos.d/vespa.repo ]]; then - cat << EOF > /etc/yum.repos.d/vespa.repo -[vespa-release-el8] -name=Vespa releases -baseurl=$ARTIFACTORY_URL/vespa/centos/8/release/\$basearch -gpgcheck=0 -enabled=1 -[vespa-release-el7] -name=Vespa releases -baseurl=$ARTIFACTORY_URL/vespa/centos/7/release/\$basearch -gpgcheck=0 -enabled=1 -EOF -fi - -VERSIONS_TO_DELETE=$(dnf list --quiet --showduplicates --disablerepo='*' --enablerepo=vespa-release-el7,vespa-release-el8 vespa | awk '/[0-9].*\.[0-9].*\.[0-9].*/{print $2}' | sort -V | head -n -200 | grep -v "7.594.36") - -RPMS_TO_DELETE=$(mktemp) -trap "rm -f $RPMS_TO_DELETE" EXIT - -for VERSION in $VERSIONS_TO_DELETE; do - curl -sSL -H "content-type:text/plain" -H "Authorization: Bearer $JFROG_API_TOKEN" \ - --data "items.find({ \"repo\": { \"\$eq\": \"vespa\" }, \"name\": {\"\$match\": \"vespa*$VERSION*\"} }).include(\"repo\", \"path\", \"name\")" \ - "$ARTIFACTORY_URL/api/search/aql" \ - | jq -re ".results[]|\"$ARTIFACTORY_URL/\(.repo)/\(.path)/\(.name)\"" >> $RPMS_TO_DELETE -done - -echo "Deleting the following RPMs:" -cat $RPMS_TO_DELETE - -if [[ -n $SCREWDRIVER ]] && [[ -z $SD_PULL_REQUEST ]]; then - for RPM in $(cat $RPMS_TO_DELETE); do - curl -sSL -H "Authorization: Bearer $JFROG_API_TOKEN" -X DELETE $RPM - done -fi - - diff --git a/screwdriver/detect-what-to-build.sh b/screwdriver/detect-what-to-build.sh deleted file mode 100755 index c755a5cdc251..000000000000 --- a/screwdriver/detect-what-to-build.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -if (( ${#BASH_SOURCE[@]} == 1 )); then - echo "This script must be sourced." - exit 1 -fi - -if [[ $SD_PULL_REQUEST == false ]]; then - export SHOULD_BUILD=all - return 0 -fi - -JSON=$(curl -sLf https://api.github.com/repos/vespa-engine/vespa/pulls/$SD_PULL_REQUEST) -PR_TITLE=$(jq -re '.title' <<< "$JSON") - -JSON=$(curl -sLf https://api.github.com/repos/vespa-engine/vespa/pulls/$SD_PULL_REQUEST/commits) -COMMITS=$(jq -re '.[].sha' <<< "$JSON") - -FILES=$(for C in $COMMITS; do JSON=$(curl -sLf https://api.github.com/repos/vespa-engine/vespa/commits/$C); jq -re '.files[].filename' <<< "$JSON"; done) - -if ! [[ $PR_TITLE =~ \[skip-systemtest\] ]]; then - SHOULD_BUILD=systemtest -elif [[ -z $FILES ]]; then - SHOULD_BUILD=all -elif ! grep -v -E "(\.h|\.hh|\.hxx|\.c|\.cpp|\.cxx)$" <<< "$FILES" &> /dev/null; then - SHOULD_BUILD=cpp -elif ! grep -v -E "(\.java)$" <<< "$FILES" &> /dev/null; then - SHOULD_BUILD=java -elif ! grep -v -E "(\.go)$" <<< "$FILES" &> /dev/null; then - SHOULD_BUILD=go -else - SHOULD_BUILD=all -fi - -export SHOULD_BUILD - diff --git a/screwdriver/factory-command.sh b/screwdriver/factory-command.sh deleted file mode 100755 index a09900ec0a0b..000000000000 --- a/screwdriver/factory-command.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -set -eo pipefail - -if (( $# < 1 )); then - echo "Usage: $0 [options]" - exit 1 -fi - -COMMAND=$1 -FACTORY_API="https://factory.vespa.aws-us-east-1a.vespa.oath.cloud/api/factory/v1" -COOKIEJAR=$(pwd)/jar.txt -trap "rm -f $COOKIEJAR" EXIT - -SESSION_TOKEN=null -WAIT_UNTIL=$(( $(date +%s) + 120 )) -set +e -while [[ $SESSION_TOKEN == null ]]; do - SESSION_TOKEN=$(curl -s -H 'Content-Type: application/json' -H 'Accept: application/json' -d "{ \"username\": \"svc-okta-vespa-factory\", \"password\": \"$SVC_OKTA_VESPA_FACTORY_TOKEN\" }" https://ouryahoo.okta.com/api/v1/authn | jq -re '.sessionToken') - - if [[ $SESSION_TOKEN == null ]]; then - if [[ $(date +%s) -ge $WAIT_UNTIL ]]; then - echo "Could not fetch session token from Okta: SESSION_TOKEN=$SESSION_TOKEN" - exit 1 - else - echo "Invalid SESSION_TOKEN=$SESSION_TOKEN . Trying again ..." >&2 - sleep 3 - fi - fi -done -set -e - -LOCATION=$(curl -s -i -c $COOKIEJAR "https://factory.vespa.aws-us-east-1a.vespa.oath.cloud/login" | grep location | awk '{print $2}' | tr -d '\r') -curl -sL -b $COOKIEJAR -c $COOKIEJAR "$LOCATION&sessionToken=$SESSION_TOKEN" &> /dev/null - -CURL="curl -sL -b $COOKIEJAR" - -shift -case $COMMAND in - get-version) - VERSION=$1 - if [[ -z $VERSION ]]; then echo "Usage: $0 $COMMAND "; exit 1; fi - $CURL "$FACTORY_API/versions/$VERSION" - ;; - create-build) - $CURL -d "{ - \"startSeconds\": $(date +%s), - \"sdApiUrl\": \"https://api.screwdriver.cd/v4/\", - \"pipelineId\": $SD_PIPELINE_ID, - \"jobId\": $SD_JOB_ID, - \"buildId\": $SD_BUILD_ID, - \"platform\": \"opensource_centos7\" - }" \ - "$FACTORY_API/builds" - ;; - create-release) - $CURL -d "{ - \"startSeconds\": $(date +%s), - \"systemName\": \"opensource\" - }" \ - "$FACTORY_API/releases" - ;; - update-build-status) - STATUS=$1 - DESCRIPTION=$2 - if [[ -z $STATUS ]] || [[ -z $DESCRIPTION ]]; then echo "Usage: $0 $COMMAND "; exit 1; fi - $CURL -d "{ - \"updatedSeconds\": $(date +%s), - \"sdApiUrl\": \"https://api.screwdriver.cd/v4/\", - \"pipelineId\": $SD_PIPELINE_ID, - \"jobId\": $SD_JOB_ID, - \"buildId\": $SD_BUILD_ID, - \"status\": \"$STATUS\", - \"description\": \"$DESCRIPTION\" - }" \ - "$FACTORY_API/builds/$SD_BUILD_ID/status" - ;; - update-released-time) - VERSION=$1 - if [[ -z $VERSION ]]; then echo "Usage: $0 $COMMAND "; exit 1; fi - $CURL -d "{ - \"releasedSeconds\": $(date +%s), - \"systemName\": \"opensource\" - }" \ - "$FACTORY_API/releases/$VERSION" - ;; - *) - echo "Unknown command $COMMAND" - exit 1 - ;; -esac diff --git a/screwdriver/publish-unpublished-rpms-to-jfrog-cloud.sh b/screwdriver/publish-unpublished-rpms-to-jfrog-cloud.sh deleted file mode 100755 index dd6f1b5f10f8..000000000000 --- a/screwdriver/publish-unpublished-rpms-to-jfrog-cloud.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -set -euo pipefail - -readonly MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# Copr repo file -if [[ ! -f /etc/yum.repos.d/group_vespa-vespa-epel-7.repo ]]; then - cat << 'EOF' > /etc/yum.repos.d/group_vespa-vespa-epel-7.repo -[copr:copr.fedorainfracloud.org:group_vespa:vespa] -name=Copr repo for vespa owned by @vespa -baseurl=https://download.copr.fedorainfracloud.org/results/@vespa/vespa/centos-stream-8-$basearch/ -type=rpm-md -gpgcheck=1 -gpgkey=https://copr-be.cloud.fedoraproject.org/results/@vespa/vespa/pubkey.gpg -repo_gpgcheck=0 -enabled=1 -EOF -fi - -# JFrog Cloud repo file -if [[ ! -f /etc/yum.repos.d/vespa.repo ]]; then - cat << 'EOF' > /etc/yum.repos.d/vespa.repo -[vespa-release] -name=Vespa releases -baseurl=https://artifactory.yahooinc.com/artifactory/vespa/centos/8/release/$basearch -gpgcheck=0 -enabled=1 -EOF -fi - -readonly COPR_PACKAGES=$(mktemp) -trap "rm -f $COPR_PACKAGES" EXIT - -dnf list -q --disablerepo='*' --enablerepo=copr:copr.fedorainfracloud.org:group_vespa:vespa --showduplicates 'vespa*' | grep "Available Packages" -A 100000 | tail -n +2 | sed '/\.src\ */d' | sed 's/\.x86_64\ */-/' | awk '{print $1}' | grep -v '.src$' > $COPR_PACKAGES - -echo "Packages on Copr:" -cat $COPR_PACKAGES -echo - -for pv in $(cat $COPR_PACKAGES); do - if ! dnf list -q --disablerepo='*' --enablerepo=vespa-release $pv &> /dev/null; then - echo "$pv not found on JFrog Clould. Downloading..." - dnf download -q --disablerepo='*' --enablerepo=copr:copr.fedorainfracloud.org:group_vespa:vespa $pv - echo "$pv downloaded." - fi -done -echo - -if ! ls *.rpm &> /dev/null; then - echo "All packages already on JFrog Cloud." - exit 0 -fi - -echo "RPMs missing on JFrog Cloud:" -ls -lh *.rpm -echo - -UPLOAD_FAILED=false -if [[ -n $SCREWDRIVER ]] && [[ -z $SD_PULL_REQUEST ]]; then - for rpm in $(ls *.rpm); do - echo "Uploading $rpm ..." - if ! $MYDIR/upload-rpm-to-artifactory.sh $rpm ; then - echo "Could not upload $rpm" - UPLOAD_FAILED=true - else - echo "$rpm uploaded" - fi - done - echo -fi - -if $UPLOAD_FAILED; then - echo "Some RPMs failed to upload" - exit 1 -fi diff --git a/screwdriver/release-container-image-docker.sh b/screwdriver/release-container-image-docker.sh deleted file mode 100755 index f2249c93dc07..000000000000 --- a/screwdriver/release-container-image-docker.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/ssh-agent /bin/bash -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -set -euo pipefail - -if [[ $# -ne 1 ]]; then - echo "Usage: $0 " - exit 1 -fi - -readonly VESPA_VERSION=$1 -readonly VESPA_MAJOR=$(echo $VESPA_VERSION | cut -d. -f1) - -if [[ -z "$DOCKER_HUB_DEPLOY_KEY" ]]; then - echo "Environment variable DOCKER_HUB_DEPLOY_KEY must be set, but is empty." - exit 1 -fi -if [[ -z "$GHCR_DEPLOY_KEY" ]]; then - echo "Environment variable GHCR_DEPLOY_KEY must be set, but is empty." - exit 1 -fi - -BUILD_DIR=$(mktemp -d) -trap "rm -rf $BUILD_DIR" EXIT -cd $BUILD_DIR - -ssh-add -D -ssh-add <(echo $DOCKER_IMAGE_DEPLOY_KEY | base64 -d) -git clone git@github.com:vespa-engine/docker-image -cd docker-image - -RELEASE_TAG="v$VESPA_VERSION" -if git rev-parse $RELEASE_TAG &> /dev/null; then - git checkout $RELEASE_TAG -else - git tag -a "$RELEASE_TAG" -m "Release version $VESPA_VERSION" - git push origin "$RELEASE_TAG" -fi - -docker info -docker version -docker buildx version -docker buildx install - -unset DOCKER_HOST -docker context create vespa-context --docker "host=tcp://localhost:2376,ca=/certs/client/ca.pem,cert=/certs/client/cert.pem,key=/certs/client/key.pem" -docker context use vespa-context - -docker buildx create --name vespa-builder --driver docker-container --use -docker buildx inspect --bootstrap - -#The minimal image seem to have issues building on cd.screwdriver.cd. Needs investigation. -#for data in "Dockerfile vespa" "Dockerfile.minimal vespa-minimal"; do - -for data in "Dockerfile vespa"; do - set -- $data - DOCKER_FILE=$1 - IMAGE_NAME=$2 - - # Push to Docker Hub - if curl -fsSL https://index.docker.io/v1/repositories/vespaengine/$IMAGE_NAME/tags/$VESPA_VERSION &> /dev/null; then - echo "Container image docker.io/vespaengine/$IMAGE_NAME:$VESPA_VERSION aldready exists." - else - # Build only for x86_64 first for test as BuildKit does not support loading multi arch into docker daemon. - docker buildx build --progress plain --load --platform linux/amd64 --build-arg VESPA_VERSION=$VESPA_VERSION \ - --file $DOCKER_FILE --tag vespaengine/$IMAGE_NAME:latest . - - # Test - $SD_SOURCE_DIR/screwdriver/test-quick-start-guide.sh - - # Build for arm64 and publish - docker login --username aressem --password "$DOCKER_HUB_DEPLOY_KEY" - docker buildx build --progress plain --push --platform linux/amd64,linux/arm64 --build-arg VESPA_VERSION=$VESPA_VERSION \ - --file $DOCKER_FILE --tag docker.io/vespaengine/$IMAGE_NAME:$VESPA_VERSION \ - --tag docker.io/vespaengine/$IMAGE_NAME:$VESPA_MAJOR --tag docker.io/vespaengine/$IMAGE_NAME:latest . - fi -done - -# Push to GitHub Container Registry -JWT=$(curl -sSL -u aressem:$GHCR_DEPLOY_KEY "https://ghcr.io/token?service=ghcr.io&scope=repository:vespa-engine/vespa:pull" | jq -re '.token') -IMAGE_TAGS=$(curl -sSL -H "Authorization: Bearer $JWT" https://ghcr.io/v2/vespa-engine/vespa/tags/list | jq -re '.tags[]') -if grep $VESPA_VERSION <<< "$IMAGE_TAGS" &> /dev/null; then - echo "Container image ghcr.io/vespa-engine/vespa:$VESPA_VERSION aldready exists." -else - docker login --username aressem --password "$GHCR_DEPLOY_KEY" ghcr.io - docker buildx build --progress plain --push --platform linux/amd64,linux/arm64 --build-arg VESPA_VERSION=$VESPA_VERSION \ - --tag ghcr.io/vespa-engine/vespa:$VESPA_VERSION --tag ghcr.io/vespa-engine/vespa:$VESPA_MAJOR \ - --tag ghcr.io/vespa-engine/vespa:latest . -fi diff --git a/screwdriver/release-container-image.sh b/screwdriver/release-container-image.sh deleted file mode 100755 index d67b389d52e1..000000000000 --- a/screwdriver/release-container-image.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/ssh-agent /bin/bash -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -set -euo pipefail - -if [[ $# -ne 1 ]]; then - echo "Usage: $0 " - exit 1 -fi - -readonly VESPA_VERSION=$1 -readonly VESPA_MAJOR=$(echo $VESPA_VERSION | cut -d. -f1) - -if [[ -z "$DOCKER_HUB_DEPLOY_KEY" ]]; then - echo "Environment variable DOCKER_HUB_DEPLOY_KEY must be set, but is empty." - exit 1 -fi -if [[ -z "$GHCR_DEPLOY_KEY" ]]; then - echo "Environment variable GHCR_DEPLOY_KEY must be set, but is empty." - exit 1 -fi - -BUILD_DIR=$(mktemp -d) -trap "rm -rf $BUILD_DIR" EXIT -cd $BUILD_DIR - -ssh-add -D -ssh-add <(echo $DOCKER_IMAGE_DEPLOY_KEY | base64 -d) -git clone git@github.com:vespa-engine/docker-image -cd docker-image - -RELEASE_TAG="v$VESPA_VERSION" -if git rev-parse $RELEASE_TAG &> /dev/null; then - git checkout $RELEASE_TAG -else - git tag -a "$RELEASE_TAG" -m "Release version $VESPA_VERSION" - git push origin "$RELEASE_TAG" -fi - -#The minimal image seem to have issues building on cd.screwdriver.cd. Needs investigation. -#for data in "Dockerfile vespa" "Dockerfile.minimal vespa-minimal"; do - -for data in "Dockerfile vespa"; do - set -- $data - DOCKER_FILE=$1 - IMAGE_NAME=$2 - - # Push to Docker Hub - if curl -fsSL https://index.docker.io/v1/repositories/vespaengine/$IMAGE_NAME/tags/$VESPA_VERSION &> /dev/null; then - echo "Container image docker.io/vespaengine/$IMAGE_NAME:$VESPA_VERSION aldready exists." - else - # Build - buildah bud \ - --build-arg VESPA_BASE_IMAGE=el8 \ - --build-arg VESPA_VERSION=$VESPA_VERSION \ - --file $DOCKER_FILE \ - --jobs 2 \ - --layers=false \ - --manifest "vespaengine/$IMAGE_NAME:$VESPA_VERSION" \ - --platform linux/amd64,linux/arm64 \ - --squash | cat - - # Test - buildah tag vespaengine/$IMAGE_NAME:$VESPA_VERSION vespaengine/$IMAGE_NAME:latest - $SD_SOURCE_DIR/screwdriver/test-quick-start-guide.sh - - # Publish - buildah login --username aressem --password "$DOCKER_HUB_DEPLOY_KEY" docker.io - buildah manifest push --all --format v2s2 vespaengine/$IMAGE_NAME:$VESPA_VERSION docker://docker.io/vespaengine/$IMAGE_NAME:$VESPA_VERSION | cat - buildah manifest push --all --format v2s2 vespaengine/$IMAGE_NAME:$VESPA_VERSION docker://docker.io/vespaengine/$IMAGE_NAME:$VESPA_MAJOR | cat - buildah manifest push --all --format v2s2 vespaengine/$IMAGE_NAME:$VESPA_VERSION docker://docker.io/vespaengine/$IMAGE_NAME:latest | cat - fi -done - -# Push to GitHub Container Registry -JWT=$(curl -sSL -u aressem:$GHCR_DEPLOY_KEY "https://ghcr.io/token?service=ghcr.io&scope=repository:vespa-engine/vespa:pull" | jq -re '.token') -IMAGE_TAGS=$(curl -sSL -H "Authorization: Bearer $JWT" https://ghcr.io/v2/vespa-engine/vespa/tags/list | jq -re '.tags[]') -if grep $VESPA_VERSION <<< "$IMAGE_TAGS" &> /dev/null; then - echo "Container image ghcr.io/vespa-engine/vespa:$VESPA_VERSION aldready exists." -else - buildah login --username aressem --password "$GHCR_DEPLOY_KEY" ghcr.io - skopeo --insecure-policy copy --retry-times 5 --all --format v2s2 docker://docker.io/vespaengine/$IMAGE_NAME:$VESPA_VERSION docker://ghcr.io/vespa-engine/vespa:$VESPA_VERSION - skopeo --insecure-policy copy --retry-times 5 --all --format v2s2 docker://docker.io/vespaengine/$IMAGE_NAME:$VESPA_VERSION docker://ghcr.io/vespa-engine/vespa:$VESPA_MAJOR - skopeo --insecure-policy copy --retry-times 5 --all --format v2s2 docker://docker.io/vespaengine/$IMAGE_NAME:$VESPA_VERSION docker://ghcr.io/vespa-engine/vespa:latest -fi diff --git a/screwdriver/release-rpms.sh b/screwdriver/release-rpms.sh deleted file mode 100755 index c539ed4be185..000000000000 --- a/screwdriver/release-rpms.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/ssh-agent /bin/bash -# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -set -euo pipefail -set -x - -if [ $# -ne 2 ]; then - echo "Usage: $0 " - exit 1 -fi - -readonly VESPA_RELEASE="$1" -readonly VESPA_REF="$2" - -# Cloudsmith repo -rpm --import 'https://dl.cloudsmith.io/public/vespa/open-source-rpms/gpg.0F3DA3C70D35DA7B.key' -curl -1sLf 'https://dl.cloudsmith.io/public/vespa/open-source-rpms/config.rpm.txt?distro=el&codename=8' > /tmp/vespa-open-source-rpms.repo -dnf config-manager --add-repo '/tmp/vespa-open-source-rpms.repo' -rm -f /tmp/vespa-open-source-rpms.repo - -VESPA_RPM_X86_64=$(dnf repoquery -y --forcearch x86_64 --repoid=vespa-open-source-rpms -q vespa | cut -d: -f2 | cut -d- -f1 | sort -V | tail -1) -echo "Latest x86_64 RPM on Copr: $VESPA_RPM_X86_64" - -VESPA_RPM_AARCH64=$(dnf repoquery -y --forcearch aarch64 --repoid=vespa-open-source-rpms -q vespa | cut -d: -f2 | cut -d- -f1 | sort -V | tail -1) -echo "Latest aarch64 RPM on Copr: $VESPA_RPM_AARCH64" - -if [[ "$VESPA_RELEASE" == "$VESPA_RPM_X86_64" ]] && [[ "$VESPA_RELEASE" == "$VESPA_RPM_AARCH64" ]]; then - echo "Vespa RPMs for version $VESPA_RELEASE already exists. Exiting." - exit 0 -fi - -echo "Using vespa repository git reference: $VESPA_REF" -ssh-add -D -set +x -ssh-add <(echo $VESPA_DEPLOY_TOKEN | base64 -d) -set -x -git clone git@github.com:vespa-engine/vespa - -cd vespa -dist/release-vespa-rpm.sh $VESPA_RELEASE $VESPA_REF - -upload_rpms() { - local ARCH=$1 - aws s3 cp s3://381492154096-build-artifacts/vespa-engine--vespa/$VESPA_RELEASE/artifacts/$ARCH/rpm-repo.tar . - aws s3 cp s3://381492154096-build-artifacts/vespa-engine--vespa/$VESPA_RELEASE/artifacts/$ARCH/rpm-repo.tar.pem . - aws s3 cp s3://381492154096-build-artifacts/vespa-engine--vespa/$VESPA_RELEASE/artifacts/$ARCH/rpm-repo.tar.sig . - cosign verify-blob \ - --certificate-identity https://buildkite.com/vespaai/vespa-engine-vespa \ - --certificate-oidc-issuer https://agent.buildkite.com \ - --signature rpm-repo.tar.sig \ - --certificate rpm-repo.tar.pem \ - rpm-repo.tar - tar xvf rpm-repo.tar - for rpm in rpms/*.rpm; do - screwdriver/upload-rpm-to-cloudsmith.sh $rpm - done - rm -rf rpms rpm-repo.* -} - -if [[ "$VESPA_RELEASE" != "$VESPA_RPM_X86_64" ]]; then - upload_rpms amd64 -fi - -if [[ "$VESPA_RELEASE" != "$VESPA_RPM_AARCH64" ]]; then - upload_rpms arm64 -fi diff --git a/screwdriver/trig-buildkite-pipeline.sh b/screwdriver/trig-buildkite-pipeline.sh deleted file mode 100755 index bf9846c32bf0..000000000000 --- a/screwdriver/trig-buildkite-pipeline.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set -euo pipefail - -if [[ $# -lt 5 ]]; then - echo "Usage: $0 " - exit 1 -fi - -PIPELINE=$1 -BRANCH=$2 -VERSION=$3 -GITREF=$4 -MESSAGE=$5 - -curl -X POST "https://api.buildkite.com/v2/organizations/vespaai/pipelines/$PIPELINE/builds" \ - -H "Content-Type: application/json" -H "Authorization: Bearer $BUILDKITE_TRIGGER_TOKEN" \ - -d "{ - \"commit\": \"HEAD\", - \"branch\": \"$BRANCH\", - \"message\": \"$MESSAGE\", - \"ignore_pipeline_branch_filters\": true, - \"env\": { - \"VESPA_VERSION\": \"$VERSION\", - \"VESPA_REF\": \"$GITREF\" - } - }"