From a7d426eb721f0d55e9db64ef0c1edd5afb864d24 Mon Sep 17 00:00:00 2001 From: Mihaly Lengyel Date: Thu, 26 Sep 2024 01:51:02 +0200 Subject: [PATCH] ci: experiment with manually runnable ci with pre-set branchnames --- .circleci/authReact.sh | 95 +++++++++++-------- .circleci/config.yml | 28 ++++-- .circleci/config_continue.yml | 14 ++- .circleci/doBackendSDKTests.sh | 19 ++-- .circleci/doUnitTests.sh | 19 ++-- .circleci/generateConfig.sh | 9 ++ .../setupAndTestBackendSDKWithFreeCore.sh | 63 +++++++----- .circleci/setupAndTestWithAuthReact.sh | 63 +++++++----- .circleci/setupAndTestWithFreeCore.sh | 64 ++++++++----- .circleci/setupAndTestWithFrontend.sh | 63 +++++++----- .circleci/website.sh | 95 +++++++++++-------- 11 files changed, 322 insertions(+), 210 deletions(-) diff --git a/.circleci/authReact.sh b/.circleci/authReact.sh index 207ae3c7d..9a936801f 100755 --- a/.circleci/authReact.sh +++ b/.circleci/authReact.sh @@ -23,59 +23,74 @@ done <<< "$version" coreDriverVersion=`echo $coreDriverArray | jq ". | last"` coreDriverVersion=`echo $coreDriverVersion | tr -d '"'` -coreFree=`curl -s -X GET \ -"https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=node" \ --H 'api-version: 1'` -if [[ `echo $coreFree | jq .core` == "null" ]] +if [ -f cdi-core-map.json ] then - echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." - exit 1 + coreFree=$coreDriverVersion +else + coreFree=`curl -s -X GET \ + "https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=node" \ + -H 'api-version: 1'` + if [[ `echo $coreFree | jq .core` == "null" ]] + then + echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." + exit 1 + fi + coreFree=$(echo $coreFree | jq .core | tr -d '"') fi -coreFree=$(echo $coreFree | jq .core | tr -d '"') frontendDriverVersion=$1 frontendDriverVersion=`echo $frontendDriverVersion | tr -d '"'` -nodeVersionXY=`curl -s -X GET \ -"https://api.supertokens.io/0/frontend-driver-interface/dependency/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendDriverVersion&driverName=node&frontendName=auth-react" \ --H 'api-version: 1'` -if [[ `echo $nodeVersionXY | jq .driver` == "null" ]] +if [ -f fdi-node-map.json ] then - echo "fetching latest X.Y version for driver given frontend-driver-interface X.Y version: $frontendDriverVersion gave response: $nodeVersionXY. Please make sure all relevant drivers have been pushed." - exit 1 -fi -nodeVersionXY=$(echo $nodeVersionXY | jq .driver | tr -d '"') + nodeTag=`cat fdi-node-map.json | jq '.["'$frontendDriverVersion'"]'` +else + nodeVersionXY=`curl -s -X GET \ + "https://api.supertokens.io/0/frontend-driver-interface/dependency/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendDriverVersion&driverName=node&frontendName=auth-react" \ + -H 'api-version: 1'` + if [[ `echo $nodeVersionXY | jq .driver` == "null" ]] + then + echo "fetching latest X.Y version for driver given frontend-driver-interface X.Y version: $frontendDriverVersion gave response: $nodeVersionXY. Please make sure all relevant drivers have been pushed." + exit 1 + fi + nodeVersionXY=$(echo $nodeVersionXY | jq .driver | tr -d '"') -nodeInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$nodeVersionXY&name=node" \ --H 'api-version: 0'` -if [[ `echo $nodeInfo | jq .tag` == "null" ]] -then - echo "fetching latest X.Y.Z version for driver, X.Y version: $nodeVersionXY gave response: $nodeInfo" - exit 1 + nodeInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$nodeVersionXY&name=node" \ + -H 'api-version: 0'` + if [[ `echo $nodeInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for driver, X.Y version: $nodeVersionXY gave response: $nodeInfo" + exit 1 + fi + nodeTag=$(echo $nodeInfo | jq .tag | tr -d '"') fi -nodeTag=$(echo $nodeInfo | jq .tag | tr -d '"') -frontendAuthReactVersionXY=`curl -s -X GET \ -"https://api.supertokens.io/0/frontend-driver-interface/dependency/frontend/latest?password=$SUPERTOKENS_API_KEY&frontendName=auth-react&mode=DEV&version=$frontendDriverVersion&driverName=node" \ --H 'api-version: 1'` -if [[ `echo $frontendAuthReactVersionXY | jq .frontend` == "null" ]] +if [ -f fdi-auth-react-map.json ] then - echo "fetching latest X.Y version for frontend given frontend-driver-interface X.Y version: $frontendDriverVersion, name: auth-react gave response: $frontend. Please make sure all relevant frontend libs have been pushed." - exit 1 -fi -frontendAuthReactVersionXY=$(echo $frontendAuthReactVersionXY | jq .frontend | tr -d '"') + frontendAuthReactTag=`cat fdi-auth-react-map.json | jq '.["'$frontendDriverVersion'"]'` +else + frontendAuthReactVersionXY=`curl -s -X GET \ + "https://api.supertokens.io/0/frontend-driver-interface/dependency/frontend/latest?password=$SUPERTOKENS_API_KEY&frontendName=auth-react&mode=DEV&version=$frontendDriverVersion&driverName=node" \ + -H 'api-version: 1'` + if [[ `echo $frontendAuthReactVersionXY | jq .frontend` == "null" ]] + then + echo "fetching latest X.Y version for frontend given frontend-driver-interface X.Y version: $frontendDriverVersion, name: auth-react gave response: $frontend. Please make sure all relevant frontend libs have been pushed." + exit 1 + fi + frontendAuthReactVersionXY=$(echo $frontendAuthReactVersionXY | jq .frontend | tr -d '"') -frontendAuthReactInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/frontend/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendAuthReactVersionXY&name=auth-react" \ --H 'api-version: 0'` -if [[ `echo $frontendAuthReactInfo | jq .tag` == "null" ]] -then - echo "fetching latest X.Y.Z version for frontend, X.Y version: $frontendAuthReactVersionXY gave response: $frontendAuthReactInfo" - exit 1 + frontendAuthReactInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/frontend/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendAuthReactVersionXY&name=auth-react" \ + -H 'api-version: 0'` + if [[ `echo $frontendAuthReactInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for frontend, X.Y version: $frontendAuthReactVersionXY gave response: $frontendAuthReactInfo" + exit 1 + fi + frontendAuthReactTag=$(echo $frontendAuthReactInfo | jq .tag | tr -d '"') + frontendAuthReactVersion=$(echo $frontendAuthReactInfo | jq .version | tr -d '"') fi -frontendAuthReactTag=$(echo $frontendAuthReactInfo | jq .tag | tr -d '"') -frontendAuthReactVersion=$(echo $frontendAuthReactInfo | jq .version | tr -d '"') if [[ $frontendDriverVersion == '1.3' || $frontendDriverVersion == '1.8' ]]; then # we skip this since the tests for auth-react here are not reliable due to race conditions... diff --git a/.circleci/config.yml b/.circleci/config.yml index 78230c4c8..385787edd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,12 +31,31 @@ jobs: setup: machine: image: ubuntu-2204:2024.04.4 + parameters: + force: + type: boolean + default: false + cdi-core-map: + type: string + default: "{}" + cdi-plugin-interface-map: + type: string + default: "{}" + fdi-node-map: + type: string + default: "{}" + fdi-auth-react-map: + type: string + default: "{}" + fdi-website-map: + type: string + default: "{}" steps: - checkout - run: name: Generate config command: | - cd .circleci && ./generateConfig.sh + cd .circleci && ./generateConfig.sh << parameters.force >> '<< parameters.cdi-core-map >>' '<< parameters.cdi-plugin-interface-map >>' '<< parameters.fdi-node-map >>' '<< parameters.fdi-auth-react-map >>' '<< parameters.fdi-website-map >>' - continuation/continue: configuration_path: .circleci/config_continue.yml # use newly generated config to continue @@ -52,12 +71,7 @@ workflows: only: /v[0-9]+(\.[0-9]+)*/ branches: ignore: /.*/ - - setup: - filters: - tags: - only: /dev-v[0-9]+(\.[0-9]+)*/ - branches: - only: /test-cicd\/.*/ + - setup - update-docs: context: - slack-notification diff --git a/.circleci/config_continue.yml b/.circleci/config_continue.yml index 7a2e18b78..d99228909 100644 --- a/.circleci/config_continue.yml +++ b/.circleci/config_continue.yml @@ -12,10 +12,9 @@ jobs: - run: echo "Testing branch << pipeline.git.branch >>" - when: condition: - not: - matches: - pattern: "^test-cicd/.*$" - value: << pipeline.git.branch >> + matches: + pattern: "^[0-9]+\\.[0-9]+$" # X.Y branches + value: << pipeline.git.branch >> steps: - checkout - run: (cd .circleci/ && ./markDevTagAsTestNotPassed.sh) @@ -100,10 +99,9 @@ jobs: - run: echo "Testing passed for branch << pipeline.git.branch >>" - when: condition: - not: - matches: - pattern: "^test-cicd/.*$" - value: << pipeline.git.branch >> + matches: + pattern: "^[0-9]+\\.[0-9]+$" # X.Y branches + value: << pipeline.git.branch >> steps: - checkout - run: (cd .circleci/ && ./markAsSuccess.sh) diff --git a/.circleci/doBackendSDKTests.sh b/.circleci/doBackendSDKTests.sh index 984a0b79b..a830b859f 100755 --- a/.circleci/doBackendSDKTests.sh +++ b/.circleci/doBackendSDKTests.sh @@ -10,15 +10,20 @@ coreDriverVersion=`echo $coreDriverVersion | tr -d '"'` frontendDriverVersion=$2 -coreFree=`curl -s -X GET \ -"https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=node" \ --H 'api-version: 1'` -if [[ `echo $coreFree | jq .core` == "null" ]] +if [ -f cdi-core-map.json ] then - echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." - exit 1 + coreFree=$coreDriverVersion +else + coreFree=`curl -s -X GET \ + "https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=node" \ + -H 'api-version: 1'` + if [[ `echo $coreFree | jq .core` == "null" ]] + then + echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." + exit 1 + fi + coreFree=$(echo $coreFree | jq .core | tr -d '"') fi -coreFree=$(echo $coreFree | jq .core | tr -d '"') cd .. ./test/testExports.sh diff --git a/.circleci/doUnitTests.sh b/.circleci/doUnitTests.sh index a59e4a916..049992666 100755 --- a/.circleci/doUnitTests.sh +++ b/.circleci/doUnitTests.sh @@ -8,15 +8,20 @@ fi coreDriverVersion=$1 coreDriverVersion=`echo $coreDriverVersion | tr -d '"'` -coreFree=`curl -s -X GET \ -"https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=node" \ --H 'api-version: 1'` -if [[ `echo $coreFree | jq .core` == "null" ]] +if [ -f cdi-core-map.json ] then - echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." - exit 1 + coreFree=`cat cdi-core-map.json | jq '.["'$coreDriverVersion'"]'` +else + coreFree=`curl -s -X GET \ + "https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=node" \ + -H 'api-version: 1'` + if [[ `echo $coreFree | jq .core` == "null" ]] + then + echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." + exit 1 + fi + coreFree=$(echo $coreFree | jq .core | tr -d '"') fi -coreFree=$(echo $coreFree | jq .core | tr -d '"') cd .. ./test/testExports.sh diff --git a/.circleci/generateConfig.sh b/.circleci/generateConfig.sh index 1dfffd6b0..5d121d4ca 100755 --- a/.circleci/generateConfig.sh +++ b/.circleci/generateConfig.sh @@ -11,3 +11,12 @@ fi sed -i -e 's/cdi-version: placeholder/cdi-version: '`printf "%q" $coreDriverArray`'/' config_continue.yml sed -i -e 's/fdi-version: placeholder/fdi-version: '`printf "%q" $frontendDriverArray`'/' config_continue.yml + +if [ "$1" = "true" ]; then + sed -i -e 's/test-cicd\\\/\.\*/.*/' config_continue.yml + sed -i -e "s@^ - checkout@ - checkout\n - run: echo '$2' >> .circleci\/cdi-core-map.json/@" config_continue.yml + sed -i -e "s@^ - checkout@ - checkout\n - run: echo '$3' >> .circleci\/cdi-plugin-interface-map.json/@" config_continue.yml + sed -i -e "s@^ - checkout@ - checkout\n - run: echo '$4' >> .circleci\/fdi-node-map.json/@" config_continue.yml + sed -i -e "s@^ - checkout@ - checkout\n - run: echo '$5' >> .circleci\/fdi-auth-react-map.json/@" config_continue.yml + sed -i -e "s@^ - checkout@ - checkout\n - run: echo '$6' >> .circleci\/fdi-website-map.json/@" config_continue.yml +fi diff --git a/.circleci/setupAndTestBackendSDKWithFreeCore.sh b/.circleci/setupAndTestBackendSDKWithFreeCore.sh index a4a563b0b..2714ca5e3 100755 --- a/.circleci/setupAndTestBackendSDKWithFreeCore.sh +++ b/.circleci/setupAndTestBackendSDKWithFreeCore.sh @@ -1,34 +1,47 @@ -coreInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ --H 'api-version: 0'` -if [[ `echo $coreInfo | jq .tag` == "null" ]] +if [ -f "cdi-core-map.json" ] then - echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo" - exit 1 + coreTag=`cat cdi-core-map.json | jq '.["'$1'"]'` + coreVersion=$coreTag +else + coreInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ + -H 'api-version: 0'` + if [[ `echo $coreInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo" + exit 1 + fi + coreTag=$(echo $coreInfo | jq .tag | tr -d '"') + coreVersion=$(echo $coreInfo | jq .version | tr -d '"') fi -coreTag=$(echo $coreInfo | jq .tag | tr -d '"') -coreVersion=$(echo $coreInfo | jq .version | tr -d '"') -pluginInterfaceVersionXY=`curl -s -X GET \ -"https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ --H 'api-version: 0'` -if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]] +if [ -f "cdi-plugin-interface-map.json" ] then - echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY" - exit 1 -fi -pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"') + pluginInterfaceTag=`cat cdi-plugin-interface-map.json | jq '.["'$coreDriverVersion'"]'` + pluginInterfaceVersionXY=$pluginInterfaceTag + pluginInterfaceVersion=$pluginInterfaceTag +else + pluginInterfaceVersionXY=`curl -s -X GET \ + "https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ + -H 'api-version: 0'` + if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]] + then + echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY" + exit 1 + fi + pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"') -pluginInterfaceInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \ --H 'api-version: 0'` -if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]] -then - echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo" - exit 1 + pluginInterfaceInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \ + -H 'api-version: 0'` + if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo" + exit 1 + fi + pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"') + pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"') fi -pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"') -pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"') echo "Testing with FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion" diff --git a/.circleci/setupAndTestWithAuthReact.sh b/.circleci/setupAndTestWithAuthReact.sh index b7f3de11e..de39c5bf1 100755 --- a/.circleci/setupAndTestWithAuthReact.sh +++ b/.circleci/setupAndTestWithAuthReact.sh @@ -1,34 +1,47 @@ -coreInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ --H 'api-version: 0'` -if [[ `echo $coreInfo | jq .tag` == "null" ]] +if [ -f "cdi-core-map.json" ] then - echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo" - exit 1 + coreTag=`cat cdi-core-map.json | jq '.["'$1'"]'` + coreVersion=$coreTag +else + coreInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ + -H 'api-version: 0'` + if [[ `echo $coreInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo" + exit 1 + fi + coreTag=$(echo $coreInfo | jq .tag | tr -d '"') + coreVersion=$(echo $coreInfo | jq .version | tr -d '"') fi -coreTag=$(echo $coreInfo | jq .tag | tr -d '"') -coreVersion=$(echo $coreInfo | jq .version | tr -d '"') -pluginInterfaceVersionXY=`curl -s -X GET \ -"https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ --H 'api-version: 0'` -if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]] +if [ -f "cdi-plugin-interface-map.json" ] then - echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY" - exit 1 -fi -pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"') + pluginInterfaceTag=`cat cdi-plugin-interface-map.json | jq '.["'$coreDriverVersion'"]'` + pluginInterfaceVersionXY=$pluginInterfaceTag + pluginInterfaceVersion=$pluginInterfaceTag +else + pluginInterfaceVersionXY=`curl -s -X GET \ + "https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ + -H 'api-version: 0'` + if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]] + then + echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY" + exit 1 + fi + pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"') -pluginInterfaceInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \ --H 'api-version: 0'` -if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]] -then - echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo" - exit 1 + pluginInterfaceInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \ + -H 'api-version: 0'` + if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo" + exit 1 + fi + pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"') + pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"') fi -pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"') -pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"') echo "Testing with frontend auth-react: $2, node tag: $3, FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion" diff --git a/.circleci/setupAndTestWithFreeCore.sh b/.circleci/setupAndTestWithFreeCore.sh index 83b0f8201..d3311fe39 100755 --- a/.circleci/setupAndTestWithFreeCore.sh +++ b/.circleci/setupAndTestWithFreeCore.sh @@ -1,35 +1,47 @@ -coreInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ --H 'api-version: 0'` -if [[ `echo $coreInfo | jq .tag` == "null" ]] +if [ -f "cdi-core-map.json" ] then - echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo" - exit 1 + coreTag=`cat cdi-core-map.json | jq '.["'$1'"]'` + coreVersion=$coreTag +else + coreInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ + -H 'api-version: 0'` + if [[ `echo $coreInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo" + exit 1 + fi + coreTag=$(echo $coreInfo | jq .tag | tr -d '"') + coreVersion=$(echo $coreInfo | jq .version | tr -d '"') fi -coreTag=$(echo $coreInfo | jq .tag | tr -d '"') -coreVersion=$(echo $coreInfo | jq .version | tr -d '"') -pluginInterfaceVersionXY=`curl -s -X GET \ -"https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ --H 'api-version: 0'` -if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]] +if [ -f "cdi-plugin-interface-map.json" ] then - echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY" - exit 1 -fi -pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"') + pluginInterfaceTag=`cat cdi-plugin-interface-map.json | jq '.["'$coreDriverVersion'"]'` + pluginInterfaceVersionXY=$pluginInterfaceTag + pluginInterfaceVersion=$pluginInterfaceTag +else + pluginInterfaceVersionXY=`curl -s -X GET \ + "https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ + -H 'api-version: 0'` + if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]] + then + echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY" + exit 1 + fi + pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"') -pluginInterfaceInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \ --H 'api-version: 0'` -if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]] -then - echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo" - exit 1 + pluginInterfaceInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \ + -H 'api-version: 0'` + if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo" + exit 1 + fi + pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"') + pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"') fi -pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"') -pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"') - echo "Testing with FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion" cd ../../ diff --git a/.circleci/setupAndTestWithFrontend.sh b/.circleci/setupAndTestWithFrontend.sh index 8e870d4bb..7f81f59b9 100755 --- a/.circleci/setupAndTestWithFrontend.sh +++ b/.circleci/setupAndTestWithFrontend.sh @@ -1,34 +1,47 @@ -coreInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ --H 'api-version: 0'` -if [[ `echo $coreInfo | jq .tag` == "null" ]] +if [ -f "cdi-core-map.json" ] then - echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo" - exit 1 + coreTag=`cat cdi-core-map.json | jq '.["'$1'"]'` + coreVersion=$coreTag +else + coreInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ + -H 'api-version: 0'` + if [[ `echo $coreInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for core, X.Y version: $1, planType: FREE gave response: $coreInfo" + exit 1 + fi + coreTag=$(echo $coreInfo | jq .tag | tr -d '"') + coreVersion=$(echo $coreInfo | jq .version | tr -d '"') fi -coreTag=$(echo $coreInfo | jq .tag | tr -d '"') -coreVersion=$(echo $coreInfo | jq .version | tr -d '"') -pluginInterfaceVersionXY=`curl -s -X GET \ -"https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ --H 'api-version: 0'` -if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]] +if [ -f "cdi-plugin-interface-map.json" ] then - echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY" - exit 1 -fi -pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"') + pluginInterfaceTag=`cat cdi-plugin-interface-map.json | jq '.["'$coreDriverVersion'"]'` + pluginInterfaceVersionXY=$pluginInterfaceTag + pluginInterfaceVersion=$pluginInterfaceTag +else + pluginInterfaceVersionXY=`curl -s -X GET \ + "https://api.supertokens.io/0/core/dependency/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$1" \ + -H 'api-version: 0'` + if [[ `echo $pluginInterfaceVersionXY | jq .pluginInterface` == "null" ]] + then + echo "fetching latest X.Y version for plugin-interface, given core X.Y version: $1, planType: FREE gave response: $pluginInterfaceVersionXY" + exit 1 + fi + pluginInterfaceVersionXY=$(echo $pluginInterfaceVersionXY | jq .pluginInterface | tr -d '"') -pluginInterfaceInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \ --H 'api-version: 0'` -if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]] -then - echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo" - exit 1 + pluginInterfaceInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/plugin-interface/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$pluginInterfaceVersionXY" \ + -H 'api-version: 0'` + if [[ `echo $pluginInterfaceInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for plugin-interface, X.Y version: $pluginInterfaceVersionXY, planType: FREE gave response: $pluginInterfaceInfo" + exit 1 + fi + pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"') + pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"') fi -pluginInterfaceTag=$(echo $pluginInterfaceInfo | jq .tag | tr -d '"') -pluginInterfaceVersion=$(echo $pluginInterfaceInfo | jq .version | tr -d '"') echo "Testing with frontend website: $2, FREE core: $coreVersion, plugin-interface: $pluginInterfaceVersion" diff --git a/.circleci/website.sh b/.circleci/website.sh index 0480b2214..781c7eaeb 100755 --- a/.circleci/website.sh +++ b/.circleci/website.sh @@ -23,59 +23,74 @@ done <<< "$version" coreDriverVersion=`echo $coreDriverArray | jq ". | last"` coreDriverVersion=`echo $coreDriverVersion | tr -d '"'` -coreFree=`curl -s -X GET \ -"https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=node" \ --H 'api-version: 1'` -if [[ `echo $coreFree | jq .core` == "null" ]] +if [ -f cdi-core-map.json ] then - echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." - exit 1 + coreFree=$coreDriverVersion +else + coreFree=`curl -s -X GET \ + "https://api.supertokens.io/0/core-driver-interface/dependency/core/latest?password=$SUPERTOKENS_API_KEY&planType=FREE&mode=DEV&version=$coreDriverVersion&driverName=node" \ + -H 'api-version: 1'` + if [[ `echo $coreFree | jq .core` == "null" ]] + then + echo "fetching latest X.Y version for core given core-driver-interface X.Y version: $coreDriverVersion, planType: FREE gave response: $coreFree. Please make sure all relevant cores have been pushed." + exit 1 + fi + coreFree=$(echo $coreFree | jq .core | tr -d '"') fi -coreFree=$(echo $coreFree | jq .core | tr -d '"') frontendDriverVersion=$1 frontendDriverVersion=`echo $frontendDriverVersion | tr -d '"'` -frontendVersionXY=`curl -s -X GET \ -"https://api.supertokens.io/0/frontend-driver-interface/dependency/frontend/latest?password=$SUPERTOKENS_API_KEY&frontendName=website&mode=DEV&version=$frontendDriverVersion&driverName=node" \ --H 'api-version: 1'` -if [[ `echo $frontendVersionXY | jq .frontend` == "null" ]] +if [ -f fdi-website-map.json ] then - echo "fetching latest X.Y version for frontend given frontend-driver-interface X.Y version: $frontendDriverVersion, name: website gave response: $frontend. Please make sure all relevant versions have been pushed." - exit 1 -fi -frontendVersionXY=$(echo $frontendVersionXY | jq .frontend | tr -d '"') + frontendTag=`cat fdi-website-map.json | jq '.["'$frontendDriverVersion'"]'` +else + frontendVersionXY=`curl -s -X GET \ + "https://api.supertokens.io/0/frontend-driver-interface/dependency/frontend/latest?password=$SUPERTOKENS_API_KEY&frontendName=website&mode=DEV&version=$frontendDriverVersion&driverName=node" \ + -H 'api-version: 1'` + if [[ `echo $frontendVersionXY | jq .frontend` == "null" ]] + then + echo "fetching latest X.Y version for frontend given frontend-driver-interface X.Y version: $frontendDriverVersion, name: website gave response: $frontend. Please make sure all relevant versions have been pushed." + exit 1 + fi + frontendVersionXY=$(echo $frontendVersionXY | jq .frontend | tr -d '"') -frontendInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/frontend/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendVersionXY&name=website" \ --H 'api-version: 0'` -if [[ `echo $frontendInfo | jq .tag` == "null" ]] -then - echo "fetching latest X.Y.Z version for frontend, X.Y version: $frontendVersionXY gave response: $frontendInfo" - exit 1 + frontendInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/frontend/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendVersionXY&name=website" \ + -H 'api-version: 0'` + if [[ `echo $frontendInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for frontend, X.Y version: $frontendVersionXY gave response: $frontendInfo" + exit 1 + fi + frontendTag=$(echo $frontendInfo | jq .tag | tr -d '"') + frontendVersion=$(echo $frontendInfo | jq .version | tr -d '"') fi -frontendTag=$(echo $frontendInfo | jq .tag | tr -d '"') -frontendVersion=$(echo $frontendInfo | jq .version | tr -d '"') -nodeVersionXY=`curl -s -X GET \ -"https://api.supertokens.io/0/frontend-driver-interface/dependency/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendDriverVersion&driverName=node&frontendName=website" \ --H 'api-version: 1'` -if [[ `echo $nodeVersionXY | jq .driver` == "null" ]] +if [ -f fdi-node-map.json ] then - echo "fetching latest X.Y version for driver given frontend-driver-interface X.Y version: $frontendDriverVersion gave response: $nodeVersionXY. Please make sure all relevant drivers have been pushed." - exit 1 -fi -nodeVersionXY=$(echo $nodeVersionXY | jq .driver | tr -d '"') + nodeTag=`cat fdi-node-map.json | jq '.["'$frontendDriverVersion'"]'` +else + nodeVersionXY=`curl -s -X GET \ + "https://api.supertokens.io/0/frontend-driver-interface/dependency/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$frontendDriverVersion&driverName=node&frontendName=website" \ + -H 'api-version: 1'` + if [[ `echo $nodeVersionXY | jq .driver` == "null" ]] + then + echo "fetching latest X.Y version for driver given frontend-driver-interface X.Y version: $frontendDriverVersion gave response: $nodeVersionXY. Please make sure all relevant drivers have been pushed." + exit 1 + fi + nodeVersionXY=$(echo $nodeVersionXY | jq .driver | tr -d '"') -nodeInfo=`curl -s -X GET \ -"https://api.supertokens.io/0/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$nodeVersionXY&name=node" \ --H 'api-version: 0'` -if [[ `echo $nodeInfo | jq .tag` == "null" ]] -then - echo "fetching latest X.Y.Z version for driver, X.Y version: $nodeVersionXY gave response: $nodeInfo" - exit 1 + nodeInfo=`curl -s -X GET \ + "https://api.supertokens.io/0/driver/latest?password=$SUPERTOKENS_API_KEY&mode=DEV&version=$nodeVersionXY&name=node" \ + -H 'api-version: 0'` + if [[ `echo $nodeInfo | jq .tag` == "null" ]] + then + echo "fetching latest X.Y.Z version for driver, X.Y version: $nodeVersionXY gave response: $nodeInfo" + exit 1 + fi + nodeTag=$(echo $nodeInfo | jq .tag | tr -d '"') fi -nodeTag=$(echo $nodeInfo | jq .tag | tr -d '"') tries=1 while [ $tries -le 3 ]