diff --git a/.drone.yml b/.drone.yml index 30d1074727fe8..7a572fba4d3c5 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1018,7 +1018,7 @@ steps: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:233 +# Generated at dronegen/tag.go:235 ################################################ kind: pipeline @@ -1110,6 +1110,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -1125,7 +1158,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:233 +# Generated at dronegen/tag.go:235 ################################################ kind: pipeline @@ -1216,6 +1249,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -1231,7 +1297,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:233 +# Generated at dronegen/tag.go:235 ################################################ kind: pipeline @@ -1320,6 +1386,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -1335,7 +1434,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:233 +# Generated at dronegen/tag.go:235 ################################################ kind: pipeline @@ -1424,6 +1523,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -1439,7 +1571,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:233 +# Generated at dronegen/tag.go:235 ################################################ kind: pipeline @@ -1531,6 +1663,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -1546,7 +1711,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:375 +# Generated at dronegen/tag.go:418 ################################################ kind: pipeline @@ -1658,6 +1823,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -1678,7 +1876,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:375 +# Generated at dronegen/tag.go:418 ################################################ kind: pipeline @@ -1787,6 +1985,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -1807,7 +2038,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:375 +# Generated at dronegen/tag.go:418 ################################################ kind: pipeline @@ -1910,6 +2141,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -1925,7 +2189,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:375 +# Generated at dronegen/tag.go:418 ################################################ kind: pipeline @@ -2025,6 +2289,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -2040,7 +2337,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:233 +# Generated at dronegen/tag.go:235 ################################################ kind: pipeline @@ -2129,6 +2426,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -2144,7 +2474,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:375 +# Generated at dronegen/tag.go:418 ################################################ kind: pipeline @@ -2256,6 +2586,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -2276,7 +2639,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:375 +# Generated at dronegen/tag.go:418 ################################################ kind: pipeline @@ -2379,6 +2742,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -2514,6 +2910,39 @@ steps: AWS_SECRET_ACCESS_KEY: from_secret: AWS_SECRET_ACCESS_KEY WORKSPACE_DIR: /tmp/build-darwin-amd64 +- name: Register artifacts + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING + WORKSPACE_DIR: /tmp/build-darwin-amd64 - name: Clean up toolchains (post) commands: - set -u @@ -2669,6 +3098,39 @@ steps: AWS_SECRET_ACCESS_KEY: from_secret: AWS_SECRET_ACCESS_KEY WORKSPACE_DIR: /tmp/build-darwin-amd64-pkg +- name: Register artifacts + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING + WORKSPACE_DIR: /tmp/build-darwin-amd64-pkg - name: Clean up exec runner storage (post) commands: - set -u @@ -2806,6 +3268,39 @@ steps: AWS_SECRET_ACCESS_KEY: from_secret: AWS_SECRET_ACCESS_KEY WORKSPACE_DIR: /tmp/build-darwin-amd64-pkg-tsh +- name: Register artifacts + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING + WORKSPACE_DIR: /tmp/build-darwin-amd64-pkg-tsh - name: Clean up exec runner storage (post) commands: - set -u @@ -2818,7 +3313,7 @@ steps: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:233 +# Generated at dronegen/tag.go:235 ################################################ kind: pipeline @@ -2907,6 +3402,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -2922,7 +3450,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:233 +# Generated at dronegen/tag.go:235 ################################################ kind: pipeline @@ -3011,6 +3539,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -3026,7 +3587,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:375 +# Generated at dronegen/tag.go:418 ################################################ kind: pipeline @@ -3129,6 +3690,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -3144,7 +3738,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:375 +# Generated at dronegen/tag.go:418 ################################################ kind: pipeline @@ -3247,6 +3841,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -3262,7 +3889,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:375 +# Generated at dronegen/tag.go:418 ################################################ kind: pipeline @@ -3374,6 +4001,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -3394,7 +4054,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:375 +# Generated at dronegen/tag.go:418 ################################################ kind: pipeline @@ -3506,6 +4166,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -3526,7 +4219,7 @@ volumes: ################################################ # Generated using dronegen, do not edit by hand! # Use 'make dronegen' to update. -# Generated at dronegen/tag.go:233 +# Generated at dronegen/tag.go:235 ################################################ kind: pipeline @@ -3618,6 +4311,39 @@ steps: source: /go/artifacts/* strip_prefix: /go/artifacts/ target: teleport/tag/${DRONE_TAG##v} +- name: Register artifacts + image: docker + commands: + - WORKSPACE_DIR=$${WORKSPACE_DIR:-/} + - VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt") + - RELEASES_HOST='https://releases-staging.platform.teleport.sh' + - echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt" + - echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key" + - trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT + - CREDENTIALS="--cert $WORKSPACE_DIR/releases.crt --key $WORKSPACE_DIR/releases.key" + - which curl || apk add --no-cache curl + - |- + cd "$WORKSPACE_DIR/go/artifacts" + for file in $(find . -type f ! -iname '*.sha256'); 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 + 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"; + done + environment: + RELEASES_CERT: + from_secret: RELEASES_CERT_STAGING + RELEASES_KEY: + from_secret: RELEASES_KEY_STAGING services: - name: Start Docker image: docker:dind @@ -4415,6 +5141,6 @@ volumes: name: drone-s3-debrepo-pvc --- kind: signature -hmac: 49638e91f2ecd4fccf05988f89a2b7515d24863fbb1a3a323a6bed4682b8d3eb +hmac: 5024d8ffe4db0d734fcb1f1a2a22d3ae2078d270dbaac7900eca0db2d1448655 ... diff --git a/dronegen/mac.go b/dronegen/mac.go index da0e9cf69d021..500867992f4c4 100644 --- a/dronegen/mac.go +++ b/dronegen/mac.go @@ -87,6 +87,10 @@ curl -sL -X POST -H 'Content-type: application/json' --data "{\"text\":\"Warning } func darwinTagPipeline() pipeline { + b := buildType{ + arch: "amd64", + os: "darwin", + } p := newDarwinPipeline("build-darwin-amd64") p.Trigger = triggerTag p.Steps = []step{ @@ -106,8 +110,8 @@ func darwinTagPipeline() pipeline { Environment: map[string]value{ "GOPATH": {raw: path.Join(p.Workspace.Path, "/go")}, "GOCACHE": {raw: path.Join(p.Workspace.Path, "/go/cache")}, - "OS": {raw: "darwin"}, - "ARCH": {raw: "amd64"}, + "OS": {raw: b.os}, + "ARCH": {raw: b.arch}, "WORKSPACE_DIR": {raw: p.Workspace.Path}, }, Commands: darwinTagBuildCommands(), @@ -130,6 +134,15 @@ func darwinTagPipeline() pipeline { }, Commands: darwinUploadToS3Commands(), }, + { + Name: "Register artifacts", + Commands: tagCreateReleaseAssetCommands(b), + Environment: map[string]value{ + "WORKSPACE_DIR": {raw: p.Workspace.Path}, + "RELEASES_CERT": value{fromSecret: "RELEASES_CERT_STAGING"}, + "RELEASES_KEY": value{fromSecret: "RELEASES_KEY_STAGING"}, + }, + }, cleanUpToolchainsStep(p.Workspace.Path), cleanUpExecStorageStep(p.Workspace.Path), } diff --git a/dronegen/mac_pkg.go b/dronegen/mac_pkg.go index 6603f12f19583..0d70b75c8a74f 100644 --- a/dronegen/mac_pkg.go +++ b/dronegen/mac_pkg.go @@ -20,6 +20,10 @@ import ( ) func darwinPkgPipeline(name, makeTarget string, pkgGlobs []string) pipeline { + b := buildType{ + arch: "amd64", + os: "darwin", + } p := newDarwinPipeline(name) p.Trigger = triggerTag p.DependsOn = []string{"build-darwin-amd64"} @@ -54,8 +58,8 @@ func darwinPkgPipeline(name, makeTarget string, pkgGlobs []string) pipeline { "BUILDBOX_PASSWORD": {fromSecret: "BUILDBOX_PASSWORD"}, "OSS_TARBALL_PATH": {raw: "/tmp/build-darwin-amd64-pkg/go/artifacts"}, "ENT_TARBALL_PATH": {raw: "/tmp/build-darwin-amd64-pkg/go/artifacts"}, - "OS": {raw: "darwin"}, - "ARCH": {raw: "amd64"}, + "OS": {raw: b.os}, + "ARCH": {raw: b.arch}, }, Commands: darwinTagPackageCommands(makeTarget), }, @@ -81,6 +85,15 @@ func darwinPkgPipeline(name, makeTarget string, pkgGlobs []string) pipeline { `aws s3 sync . s3://$AWS_S3_BUCKET/teleport/tag/${DRONE_TAG##v}`, }, }, + { + Name: "Register artifacts", + Commands: tagCreateReleaseAssetCommands(b), + Environment: map[string]value{ + "WORKSPACE_DIR": {raw: p.Workspace.Path}, + "RELEASES_CERT": value{fromSecret: "RELEASES_CERT_STAGING"}, + "RELEASES_KEY": value{fromSecret: "RELEASES_KEY_STAGING"}, + }, + }, cleanUpExecStorageStep(p.Workspace.Path), } diff --git a/dronegen/tag.go b/dronegen/tag.go index d27451adf7628..0c7730069e1e2 100644 --- a/dronegen/tag.go +++ b/dronegen/tag.go @@ -25,6 +25,8 @@ const ( debPackage = "deb" ) +const releasesHost = "https://releases-staging.platform.teleport.sh" + // tagCheckoutCommands builds a list of commands for Drone to check out a git commit on a tag build func tagCheckoutCommands(fips bool) []string { commands := []string{ @@ -268,6 +270,15 @@ func tagPipeline(b buildType) pipeline { target: "teleport/tag/${DRONE_TAG##v}", stripPrefix: "/go/artifacts/", }), + { + Name: "Register artifacts", + Image: "docker", + Commands: tagCreateReleaseAssetCommands(b), + Environment: map[string]value{ + "RELEASES_CERT": value{fromSecret: "RELEASES_CERT_STAGING"}, + "RELEASES_KEY": value{fromSecret: "RELEASES_KEY_STAGING"}, + }, + }, } return p } @@ -308,6 +319,38 @@ func tagCopyPackageArtifactCommands(b buildType, packageType string) []string { return commands } +// createReleaseAssetCommands generates a set of commands to create release & asset in release management service +func tagCreateReleaseAssetCommands(b buildType) []string { + commands := []string{ + `WORKSPACE_DIR=$${WORKSPACE_DIR:-/}`, + `VERSION=$(cat "$WORKSPACE_DIR/go/.version.txt")`, + fmt.Sprintf(`RELEASES_HOST='%v'`, releasesHost), + `echo "$RELEASES_CERT" | base64 -d > "$WORKSPACE_DIR/releases.crt"`, + `echo "$RELEASES_KEY" | base64 -d > "$WORKSPACE_DIR/releases.key"`, + `trap "rm -f '$WORKSPACE_DIR/releases.crt' '$WORKSPACE_DIR/releases.key'" EXIT`, + `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 + # 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 + 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"; +done`, + b.os, b.arch /* TODO: fips */), + } + return commands +} + // tagPackagePipeline generates a tag package pipeline for a given combination of os/arch/FIPS func tagPackagePipeline(packageType string, b buildType) pipeline { if packageType == "" { @@ -419,6 +462,15 @@ func tagPackagePipeline(packageType string, b buildType) pipeline { target: "teleport/tag/${DRONE_TAG##v}", stripPrefix: "/go/artifacts/", }), + { + Name: "Register artifacts", + Image: "docker", + Commands: tagCreateReleaseAssetCommands(b), + Environment: map[string]value{ + "RELEASES_CERT": value{fromSecret: "RELEASES_CERT_STAGING"}, + "RELEASES_KEY": value{fromSecret: "RELEASES_KEY_STAGING"}, + }, + }, } return p }