Skip to content

An open-source, faster Devin alternative

TypeScript

fix: preserve ferry workflow shell commands (#1010)

Mohamed Habib29d4fa38ff33
diff --git a/.github/workflows/ferry-worker-secrets-to-infisical.yml b/.github/workflows/ferry-worker-secrets-to-infisical.yml
index 9b84bdcb..5278c562 100644
--- a/.github/workflows/ferry-worker-secrets-to-infisical.yml
+++ b/.github/workflows/ferry-worker-secrets-to-infisical.yml
@@ -49,10 +49,8 @@ jobs:
: "${INFISICAL_IDENTITY_ID:?missing INFISICAL_IDENTITY_ID}"
: "${INFISICAL_PROJECT_SLUG:?missing INFISICAL_PROJECT_SLUG}"
- deployment="$(
- curl --proto '=https' --tlsv1.2 --fail --silent --show-error + --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" + "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/workers/scripts/$API_EDGE_WORKER/deployments"
- )"
- jq --exit-status + --arg live "$API_EDGE_LIVE_VERSION" + --arg ferry "$API_EDGE_FERRY_VERSION" '
+ deployment="$(curl --proto '=https' --tlsv1.2 --fail --silent --show-error --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/workers/scripts/$API_EDGE_WORKER/deployments")"
+ jq --exit-status --arg live "$API_EDGE_LIVE_VERSION" --arg ferry "$API_EDGE_FERRY_VERSION" '
.success == true and
(.result.deployments | max_by(.created_on).versions) as $versions and
($versions | length) == 2 and
@@ -60,9 +58,7 @@ jobs:
any($versions[]; .version_id == $ferry and .percentage == 0)
' <<<"$deployment" >/dev/null
- versions="$(
- curl --proto '=https' --tlsv1.2 --fail --silent --show-error + --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" + "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/workers/scripts/opencomputer-log-tail-prod/versions"
- )"
+ versions="$(curl --proto '=https' --tlsv1.2 --fail --silent --show-error --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" "https://api.cloudflare.com/client/v4/accounts/$CF_ACCOUNT_ID/workers/scripts/opencomputer-log-tail-prod/versions")"
jq --exit-status --arg ferry "$LOG_TAIL_FERRY_VERSION" '
.success == true and any(.result.items[]; .id == $ferry)
' <<<"$versions" >/dev/null
@@ -75,17 +71,12 @@ jobs:
set -Eeuo pipefail
umask 077
- oidc_response="$(
- curl --proto '=https' --tlsv1.2 --fail --silent --show-error + --header "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" + "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=https%3A%2F%2Fgithub.com%2Fdiggerhq"
- )"
+ oidc_response="$(curl --proto '=https' --tlsv1.2 --fail --silent --show-error --header "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=https%3A%2F%2Fgithub.com%2Fdiggerhq")"
oidc_jwt="$(jq --exit-status --raw-output '.value | strings | select(length > 0)' <<<"$oidc_response")"
printf '::add-mask::%s\n' "$oidc_jwt"
unset oidc_response
- login_response="$(
- jq --null-input + --arg identityId "$INFISICAL_IDENTITY_ID" + --arg jwt "$oidc_jwt" + '{identityId: $identityId, jwt: $jwt}' |
- curl --proto '=https' --tlsv1.2 --fail --silent --show-error + --request POST + --header 'Content-Type: application/json' + --data-binary @- + https://app.infisical.com/api/v1/auth/oidc-auth/login
- )"
+ login_response="$(jq --null-input --arg identityId "$INFISICAL_IDENTITY_ID" --arg jwt "$oidc_jwt" '{identityId: $identityId, jwt: $jwt}' | curl --proto '=https' --tlsv1.2 --fail --silent --show-error --request POST --header 'Content-Type: application/json' --data-binary @- https://app.infisical.com/api/v1/auth/oidc-auth/login)"
unset oidc_jwt
infisical_token="$(jq --exit-status --raw-output '.accessToken | strings | select(length > 0)' <<<"$login_response")"
printf '::add-mask::%s\n' "$infisical_token"
@@ -93,7 +84,7 @@ jobs:
revoke_token() {
jq --null-input --arg accessToken "$infisical_token" '{accessToken: $accessToken}' |
- curl --proto '=https' --tlsv1.2 --silent --show-error + --request POST + --header 'Content-Type: application/json' + --data-binary @- + --output /dev/null + https://app.infisical.com/api/v1/auth/token/revoke || true
+ curl --proto '=https' --tlsv1.2 --silent --show-error --request POST --header 'Content-Type: application/json' --data-binary @- --output /dev/null https://app.infisical.com/api/v1/auth/token/revoke || true
}
trap revoke_token EXIT
@@ -103,11 +94,8 @@ jobs:
local url="$3"
shift 3
local result
- result="$(
- jq --null-input + --arg accessToken "$infisical_token" + --arg trigger "$FERRY_TRIGGER" + --arg mode "$FERRY_MODE" + '{accessToken: $accessToken, trigger: $trigger, mode: $mode}' |
- curl --proto '=https' --tlsv1.2 --fail-with-body --silent --show-error + --request POST + --header 'Content-Type: application/json' + "$@" + --data-binary @- + "$url"
- )"
- jq --exit-status + --arg operation "$operation" + --arg mode "$FERRY_MODE" + --argjson expected "$expected" '
+ result="$(jq --null-input --arg accessToken "$infisical_token" --arg trigger "$FERRY_TRIGGER" --arg mode "$FERRY_MODE" '{accessToken: $accessToken, trigger: $trigger, mode: $mode}' | curl --proto '=https' --tlsv1.2 --fail-with-body --silent --show-error --request POST --header 'Content-Type: application/json' "$@" --data-binary @- "$url")"
+ jq --exit-status --arg operation "$operation" --arg mode "$FERRY_MODE" --argjson expected "$expected" '
.ok == true and
.operation == $operation and
.mode == $mode and
@@ -116,5 +104,5 @@ jobs:
jq '{operation, mode, expected, equal, missing, created, verified}' <<<"$result"
}
- invoke + track-e-opencomputer-api-edge-v1 + 24 + "$API_EDGE_URL" + --header "Cloudflare-Workers-Version-Overrides: $API_EDGE_WORKER=\"$API_EDGE_FERRY_VERSION\""
- invoke + track-e-opencomputer-log-tail-v1 + 1 + "$LOG_TAIL_URL"
+ invoke track-e-opencomputer-api-edge-v1 24 "$API_EDGE_URL" --header "Cloudflare-Workers-Version-Overrides: $API_EDGE_WORKER=\"$API_EDGE_FERRY_VERSION\""
+ invoke track-e-opencomputer-log-tail-v1 1 "$LOG_TAIL_URL"