From b24b561560707161d4b75dbecafeb83c5ee3c7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Justinas=20Stankevi=C4=8Dius?= Date: Wed, 6 Apr 2022 16:35:45 +0300 Subject: [PATCH] Release pipeline improvements (#10707) --- .drone.yml | 788 ++++++++++++++++++++++++++++++-------------- dronegen/common.go | 76 +++++ dronegen/mac.go | 2 +- dronegen/mac_pkg.go | 8 +- dronegen/tag.go | 48 ++- 5 files changed, 659 insertions(+), 263 deletions(-) diff --git a/.drone.yml b/.drone.yml index deabbdda97a..5ab4864ac50 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1052,7 +1052,7 @@ steps: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:230 +# Generated at dronegen/tag.go:240 ################################################ kind: pipeline @@ -1090,8 +1090,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -1158,20 +1163,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 64-bit (RHEL/CentOS 7.x compatible)" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -1194,7 +1209,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:230 +# Generated at dronegen/tag.go:240 ################################################ kind: pipeline @@ -1232,8 +1247,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -1299,20 +1319,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 64-bit (RHEL/CentOS 7.x compatible, FedRAMP/FIPS)" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -1335,7 +1365,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:230 +# Generated at dronegen/tag.go:240 ################################################ kind: pipeline @@ -1373,8 +1403,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -1438,20 +1473,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 64-bit" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -1474,7 +1519,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:230 +# Generated at dronegen/tag.go:240 ################################################ kind: pipeline @@ -1512,8 +1557,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -1577,20 +1627,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 64-bit (FedRAMP/FIPS)" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -1613,7 +1673,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:431 +# Generated at dronegen/tag.go:451 ################################################ kind: pipeline @@ -1650,8 +1710,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -1738,20 +1803,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 64-bit RPM (RHEL/CentOS 7.x compatible)" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -1779,7 +1854,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:431 +# Generated at dronegen/tag.go:451 ################################################ kind: pipeline @@ -1816,8 +1891,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -1901,20 +1981,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 64-bit RPM (RHEL/CentOS 7.x compatible, FedRAMP/FIPS)" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -1942,7 +2032,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:431 +# Generated at dronegen/tag.go:451 ################################################ kind: pipeline @@ -1979,8 +2069,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -2058,20 +2153,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 64-bit DEB" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -2094,7 +2199,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:431 +# Generated at dronegen/tag.go:451 ################################################ kind: pipeline @@ -2131,8 +2236,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -2207,20 +2317,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 64-bit DEB (FedRAMP/FIPS)" -F os="linux" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -2243,7 +2363,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:230 +# Generated at dronegen/tag.go:240 ################################################ kind: pipeline @@ -2281,8 +2401,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -2346,20 +2471,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="386" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 32-bit" -F os="linux" -F arch="386" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -2382,7 +2517,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:431 +# Generated at dronegen/tag.go:451 ################################################ kind: pipeline @@ -2419,8 +2554,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -2507,20 +2647,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="386" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 32-bit RPM" -F os="linux" -F arch="386" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -2548,7 +2698,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:431 +# Generated at dronegen/tag.go:451 ################################################ kind: pipeline @@ -2585,8 +2735,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -2664,20 +2819,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="386" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux 32-bit DEB" -F os="linux" -F arch="386" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -2832,20 +2997,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="darwin" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="MacOS Intel" -F os="darwin" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -3021,20 +3196,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="darwin" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="MacOS Intel .pkg installer" -F os="darwin" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -3192,20 +3377,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="darwin" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="MacOS Intel .pkg installer (tsh client only)" -F os="darwin" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -3226,7 +3421,7 @@ steps: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:230 +# Generated at dronegen/tag.go:240 ################################################ kind: pipeline @@ -3264,8 +3459,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -3329,20 +3529,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="arm" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux ARMv7 (32-bit)" -F os="linux" -F arch="arm" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -3365,7 +3575,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:230 +# Generated at dronegen/tag.go:240 ################################################ kind: pipeline @@ -3403,8 +3613,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -3468,20 +3683,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="arm64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux ARM64/ARMv8 (64-bit)" -F os="linux" -F arch="arm64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -3504,7 +3729,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:431 +# Generated at dronegen/tag.go:451 ################################################ kind: pipeline @@ -3541,8 +3766,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -3620,20 +3850,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="arm64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux ARM64/ARMv8 (64-bit) DEB" -F os="linux" -F arch="arm64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -3656,7 +3896,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:431 +# Generated at dronegen/tag.go:451 ################################################ kind: pipeline @@ -3693,8 +3933,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -3772,20 +4017,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="arm" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux ARMv7 (32-bit) DEB" -F os="linux" -F arch="arm" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -3808,7 +4063,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:431 +# Generated at dronegen/tag.go:451 ################################################ kind: pipeline @@ -3845,8 +4100,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -3933,20 +4193,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="arm64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux ARM64/ARMv8 (64-bit) RPM" -F os="linux" -F arch="arm64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -3974,7 +4244,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:431 +# Generated at dronegen/tag.go:451 ################################################ kind: pipeline @@ -4011,8 +4281,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -4099,20 +4374,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="linux" -F arch="arm" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Linux ARMv7 (32-bit) RPM" -F os="linux" -F arch="arm" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -4140,7 +4425,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:230 +# Generated at dronegen/tag.go:240 ################################################ kind: pipeline @@ -4178,8 +4463,13 @@ steps: - git submodule update --init --recursive webassets || true - rm -f /root/.ssh/id_rsa - mkdir -p /go/cache /go/artifacts - - if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; - else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt + - |- + VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) + if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 + fi + echo "$$VERSION" > /go/.version.txt environment: GITHUB_PRIVATE_KEY: from_secret: GITHUB_PRIVATE_KEY @@ -4246,20 +4536,30 @@ steps: - which curl || apk add --no-cache curl - |- cd "$WORKSPACE_DIR/go/artifacts" - for file in $(find . -type f ! -iname '*.sha256'); do + for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="windows" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="Windows 64-bit (tsh client only)" -F os="windows" -F arch="amd64" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done environment: RELEASES_CERT: @@ -5088,6 +5388,6 @@ volumes: name: drone-s3-debrepo-pvc --- kind: signature -hmac: 67c18f88ef207c41cb5a2ca671ef691be25353d179cd2a2268ed5b50893b5c38 +hmac: b9ae19a816d40a43d4307cb8395ddbe141b8c2eddb1cc1c905eabc95ff8795a5 ... diff --git a/dronegen/common.go b/dronegen/common.go index a07566edd18..9e04e3d8e37 100644 --- a/dronegen/common.go +++ b/dronegen/common.go @@ -19,6 +19,7 @@ import ( "fmt" "log" "os/exec" + "strings" ) var ( @@ -86,6 +87,81 @@ type buildType struct { windowsUnsigned bool } +// Description provides a human-facing description of the artifact, e.g.: +// Windows 64-bit (tsh client only) +// Linux ARMv7 (32-bit) +// MacOS Intel .pkg installer +func (b *buildType) Description(packageType string, extraQualifications ...string) string { + var result string + + var os string + var arch string + var darwinArch string + var bitness int + var qualifications []string + + switch b.os { + case "linux": + os = "Linux" + case "darwin": + os = "MacOS" + case "windows": + os = "Windows" + default: + panic(fmt.Sprintf("unhandled OS: %s", b.os)) + } + + switch b.arch { + case "arm64": + arch = "ARM64/ARMv8" + darwinArch = "Apple Silicon" + bitness = 64 + case "amd64": + darwinArch = "Intel" + bitness = 64 + + case "arm": + arch = "ARMv7" + fallthrough + case "386": + bitness = 32 + + default: + panic(fmt.Sprintf("unhandled arch: %s", b.arch)) + } + + if b.centos7 { + qualifications = append(qualifications, "RHEL/CentOS 7.x compatible") + } + if b.fips { + qualifications = append(qualifications, "FedRAMP/FIPS") + } + + qualifications = append(qualifications, extraQualifications...) + + result = os + + if b.os == "darwin" { + result += fmt.Sprintf(" %s", darwinArch) + } else { + // arch is implicit for Windows/Linux i386/amd64 + if arch == "" { + result += fmt.Sprintf(" %d-bit", bitness) + } else { + result += fmt.Sprintf(" %s (%d-bit)", arch, bitness) + } + } + + if packageType != "" { + result += fmt.Sprintf(" %s", packageType) + } + + if len(qualifications) > 0 { + result += fmt.Sprintf(" (%s)", strings.Join(qualifications, ", ")) + } + return result +} + // dockerService generates a docker:dind service // It includes the Docker socket volume by default, plus any extra volumes passed in func dockerService(v ...volumeRef) service { diff --git a/dronegen/mac.go b/dronegen/mac.go index a20a831799a..24328a3f853 100644 --- a/dronegen/mac.go +++ b/dronegen/mac.go @@ -136,7 +136,7 @@ func darwinTagPipeline() pipeline { }, { Name: "Register artifacts", - Commands: tagCreateReleaseAssetCommands(b), + Commands: tagCreateReleaseAssetCommands(b, "", nil), Failure: "ignore", Environment: map[string]value{ "WORKSPACE_DIR": {raw: p.Workspace.Path}, diff --git a/dronegen/mac_pkg.go b/dronegen/mac_pkg.go index 4cecacf4307..395ce5bc9f5 100644 --- a/dronegen/mac_pkg.go +++ b/dronegen/mac_pkg.go @@ -20,7 +20,7 @@ import ( "strings" ) -func darwinPkgPipeline(name, makeTarget string, pkgGlobs []string) pipeline { +func darwinPkgPipeline(name, makeTarget string, pkgGlobs []string, extraQualifications []string) pipeline { b := buildType{ arch: "amd64", os: "darwin", @@ -88,7 +88,7 @@ func darwinPkgPipeline(name, makeTarget string, pkgGlobs []string) pipeline { }, { Name: "Register artifacts", - Commands: tagCreateReleaseAssetCommands(b), + Commands: tagCreateReleaseAssetCommands(b, ".pkg installer", extraQualifications), Failure: "ignore", Environment: map[string]value{ "WORKSPACE_DIR": {raw: p.Workspace.Path}, @@ -103,11 +103,11 @@ func darwinPkgPipeline(name, makeTarget string, pkgGlobs []string) pipeline { } func darwinTeleportPkgPipeline() pipeline { - return darwinPkgPipeline("build-darwin-amd64-pkg", "pkg", []string{"build/teleport*.pkg", "e/build/teleport-ent*.pkg"}) + return darwinPkgPipeline("build-darwin-amd64-pkg", "pkg", []string{"build/teleport*.pkg", "e/build/teleport-ent*.pkg"}, nil) } func darwinTshPkgPipeline() pipeline { - return darwinPkgPipeline("build-darwin-amd64-pkg-tsh", "pkg-tsh", []string{"build/tsh*.pkg"}) + return darwinPkgPipeline("build-darwin-amd64-pkg-tsh", "pkg-tsh", []string{"build/tsh*.pkg"}, []string{"tsh client only"}) } func darwinTagDownloadArtifactCommands() []string { diff --git a/dronegen/tag.go b/dronegen/tag.go index 470c573133d..a2cade6f34b 100644 --- a/dronegen/tag.go +++ b/dronegen/tag.go @@ -45,7 +45,12 @@ func tagCheckoutCommands(fips bool) []string { // create necessary directories `mkdir -p /go/cache /go/artifacts`, // set version - `if [[ "${DRONE_TAG}" != "" ]]; then echo "${DRONE_TAG##v}" > /go/.version.txt; else egrep ^VERSION Makefile | cut -d= -f2 > /go/.version.txt; fi; cat /go/.version.txt`, + `VERSION=$(egrep ^VERSION Makefile | cut -d= -f2) +if [ "$$VERSION" != "${DRONE_TAG##v}" ]; then + echo "Mismatch between Makefile version: $$VERSION and git tag: $DRONE_TAG" + exit 1 +fi +echo "$$VERSION" > /go/.version.txt`, } return commands } @@ -227,6 +232,11 @@ func tagPipeline(b buildType) pipeline { tagEnvironment["WINDOWS_SIGNING_CERT"] = value{fromSecret: "WINDOWS_SIGNING_CERT"} } + var extraQualifications []string + if b.os == "windows" { + extraQualifications = []string{"tsh client only"} + } + p := newKubePipeline(pipelineName) p.Environment = map[string]value{ "BUILDBOX_VERSION": buildboxVersion, @@ -269,8 +279,8 @@ func tagPipeline(b buildType) pipeline { { Name: "Register artifacts", Image: "docker", + Commands: tagCreateReleaseAssetCommands(b, "", extraQualifications), Failure: "ignore", - Commands: tagCreateReleaseAssetCommands(b), Environment: map[string]value{ "RELEASES_CERT": value{fromSecret: "RELEASES_CERT_STAGING"}, "RELEASES_KEY": value{fromSecret: "RELEASES_KEY_STAGING"}, @@ -322,7 +332,7 @@ func tagCopyPackageArtifactCommands(b buildType, packageType string) []string { } // createReleaseAssetCommands generates a set of commands to create release & asset in release management service -func tagCreateReleaseAssetCommands(b buildType) []string { +func tagCreateReleaseAssetCommands(b buildType, packageType string, extraQualifications []string) []string { commands := []string{ `WORKSPACE_DIR=$${WORKSPACE_DIR:-/}`, `VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt")`, @@ -333,22 +343,32 @@ func tagCreateReleaseAssetCommands(b buildType) []string { `CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key"`, `which curl || apk add --no-cache curl`, fmt.Sprintf(`cd "$WORKSPACE_DIR/go/artifacts" -for file in $(find . -type f ! -iname '*.sha256'); do +for file in $(find . -type f ! -iname '*.sha256' ! -iname '*-unsigned.zip*'); do # Skip files that are not results of this build # (e.g. tarballs from which OS packages are made) [ -f "$file.sha256" ] || continue - product="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z - shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" - status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") - if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then - echo "curl HTTP status: $status_code" - cat $WORKSPACE_DIR/curl_out.txt - exit 1 + name="$(basename "$file" | sed -E 's/(-|_)v?[0-9].*$//')" # extract part before -vX.Y.Z + if [ "$name" = "tsh" ]; then + products="teleport teleport-ent"; + else + products="$name" fi - curl $CREDENTIALS --fail -o /dev/null -F description="TODO" -F os="%s" -F arch="%s" -F "file=@$file" -F "sha256=$shasum" -F "releaseId=$product@$VERSION" "$RELEASES_HOST/assets"; + shasum="$(cat "$file.sha256" | cut -d ' ' -f 1)" + + curl $CREDENTIALS --fail -o /dev/null -F description="%[1]s" -F os="%[2]s" -F arch="%[3]s" -F "file=@$file" -F "sha256=$shasum" "$RELEASES_HOST/assets"; + + for product in $products; do + status_code=$(curl $CREDENTIALS -o "$WORKSPACE_DIR/curl_out.txt" -w "%%{http_code}" -F "product=$product" -F "version=$VERSION" -F notesMd="# Teleport $VERSION" -F status=draft "$RELEASES_HOST/releases") + if [ $status_code -ne 200 ] && [ $status_code -ne 409 ]; then + echo "curl HTTP status: $status_code" + cat $WORKSPACE_DIR/curl_out.txt + exit 1 + fi + curl $CREDENTIALS --fail -o /dev/null -X PUT "$RELEASES_HOST/releases/$product@$VERSION/assets/$(basename $file)" + done done`, - b.os, b.arch /* TODO: fips */), + b.Description(packageType, extraQualifications...), b.os, b.arch), } return commands } @@ -478,7 +498,7 @@ func tagPackagePipeline(packageType string, b buildType) pipeline { { Name: "Register artifacts", Image: "docker", - Commands: tagCreateReleaseAssetCommands(b), + Commands: tagCreateReleaseAssetCommands(b, strings.ToUpper(packageType), nil), Failure: "ignore", Environment: map[string]value{ "RELEASES_CERT": value{fromSecret: "RELEASES_CERT_STAGING"},