-packagecloud_verify(){
- echo "INFO: Verifying $1 exists in staging..."
- if [[ $1 == $(curl --netrc-file ~/packagecloud_api --silent \
- https://packagecloud.io/api/v1/repos/"$2"/staging/search?q="$1" \
- | yq -r .[].filename) ]]; then
- echo "INFO: $1 exists in staging!"
- echo "INFO: Existing package location: https://packagecloud.io$(curl \
- --netrc-file ~/packagecloud_api --silent \
- https://packagecloud.io/api/v1/repos/"$2"/staging/search?q="$1" \
- | yq -r .[].package_html_url)"
- else
- echo "ERROR: $1 does not exist in staging"
- exit 1
- fi
-}
-
-packagecloud_promote(){
- echo "INFO: Preparing to promote $1..."
- promote_url="https://packagecloud.io$(curl --netrc-file ~/packagecloud_api \
- --silent https://packagecloud.io/api/v1/repos/"$2"/staging/search?q="$1" \
- | yq -r .[].promote_url)"
- echo "INFO: Promoting $1 from staging to release"
- curl --netrc-file ~/packagecloud_api -X POST -F \
- destination="$2/release" "$promote_url" \
- | echo "INFO: Promoted package location: \
- https://packagecloud.io$(yq -r .package_html_url)"
- git checkout "$REF"
- tag-git-repo
-}
-
-artifact_release_file(){
- echo "INFO: Processing artifact release"
- mkdir artifacts
- ORG=$(echo "$NEXUS_URL" | awk -F'.' '{print $2}')
-
- for namequoted in $(yq '.artifacts[].name' $release_file); do
- pathquoted=$(yq ".artifacts[] |select(.name==$namequoted) |.path" $release_file)
-
- #Remove extra yaml quotes
- name="${namequoted#\"}"
- name="${name%\"}"
- path="${pathquoted#\"}"
- path="${path%\"}"
-
- echo "$name"
- echo "$path"
- echo "INFO: Merge will post artifact: $name"
- # Attempt to pull from releases to see if the artifact has been released.
- if "${NEXUS_URL}"/content/repositories/releases/org/"${ORG}"/"${VERSION}"/"$name"; then
- echo "INFO: $name is already released as version:$VERSION, Continuing..."
- else
- echo "INFO: $name not found in releases, release will be prepared. Continuing..."
- wget "${path}"/"${name}" -o artifacts/"${name}"
- if [[ "$JOB_NAME" =~ "merge" ]] && [[ "$DRY_RUN" = false ]]; then
- #lftools sign sigul artifacts
- curl -v -u <NEXUSUSER>:<NEXUSPASS> --upload-file "${NEXUS_URL}"/content/repositories/releases/org/"${ORG}"/"${VERSION}"/"${name}" \;
- fi
- echo "#########################"
- fi
- done
-}
-