Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add option to run the CI scripts manually #929

Merged
merged 30 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a7d426e
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 25, 2024
b0cd70b
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
a8fe402
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
aecd12e
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
1762a23
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
945351a
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
14ac177
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
3c5e970
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
d778d29
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
aa2e806
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
446c38f
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
67c5478
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
8641f16
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
0cbf528
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
d836e9a
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
15691f3
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
a5d4f01
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
bd7d733
fix: test fixing
porcellus Sep 26, 2024
4b49700
ci: experiment with manually runnable ci with pre-set branchnames
porcellus Sep 26, 2024
faab5a1
test: make integration test server more stable
porcellus Sep 26, 2024
c000698
ci: update ci runner script
porcellus Sep 27, 2024
950a328
fix: adding hydra to circleci
sattvikc Sep 27, 2024
fbd7618
ci: add missing branch mapping
porcellus Sep 27, 2024
9bc210e
fix: force script
sattvikc Sep 27, 2024
22d1be2
fix: update ci config
sattvikc Sep 27, 2024
5ee585f
fix: update ci config
sattvikc Sep 27, 2024
1f2c4e6
fix: update script
sattvikc Sep 27, 2024
5b2fc6a
fix: update script
sattvikc Sep 27, 2024
e078650
fix: update script
sattvikc Sep 27, 2024
1e3e261
fix: ory image
sattvikc Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 71 additions & 36 deletions .circleci/authReact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,59 +23,94 @@ 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" ]]
coreFree="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
cat cdi-core-map.json
echo "coreDriverVersion: $coreDriverVersion"

coreBranchName=`cat cdi-core-map.json | jq -r '.["'$coreDriverVersion'"]'`
if [ "$coreBranchName" != "null" ]
then
coreFree=$coreDriverVersion
fi
fi

if [ "$coreFree" == "null" ]
then
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" ]]
nodeTag="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
nodeTag=`cat fdi-node-map.json | jq '.["'$frontendDriverVersion'"]' | tr -d '"'`
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" ]]
if [ "$nodeTag" == "null" ]
then
echo "fetching latest X.Y.Z version for driver, X.Y version: $nodeVersionXY gave response: $nodeInfo"
exit 1
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
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" ]]
frontendAuthReactTag="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
frontendAuthReactTag=`cat fdi-auth-react-map.json | jq '.["'$frontendDriverVersion'"]' | tr -d '"'`
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" ]]
if [ "$frontendAuthReactTag" == "null" ]
then
echo "fetching latest X.Y.Z version for frontend, X.Y version: $frontendAuthReactVersionXY gave response: $frontendAuthReactInfo"
exit 1
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
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...
Expand Down
30 changes: 23 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ orbs:
continuation: circleci/[email protected]
slack: circleci/[email protected]
jq: circleci/[email protected]

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: "{}"

jobs:
publish:
docker:
Expand Down Expand Up @@ -36,7 +57,7 @@ jobs:
- run:
name: Generate config
command: |
cd .circleci && ./generateConfig.sh
cd .circleci && ./generateConfig.sh << pipeline.parameters.force >> '<< pipeline.parameters.cdi-core-map >>' '<< pipeline.parameters.cdi-plugin-interface-map >>' '<< pipeline.parameters.fdi-node-map >>' '<< pipeline.parameters.fdi-auth-react-map >>' '<< pipeline.parameters.fdi-website-map >>'
- continuation/continue:
configuration_path: .circleci/config_continue.yml # use newly generated config to continue

Expand All @@ -52,12 +73,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
Expand Down
39 changes: 31 additions & 8 deletions .circleci/config_continue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ orbs:
continuation: circleci/[email protected]
slack: circleci/[email protected]
jq: circleci/[email protected]

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: "{}"

jobs:
test-dev-tag-as-not-passed:
docker:
Expand All @@ -12,16 +33,16 @@ 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)
test-unit:
docker:
- image: rishabhpoddar/supertokens_node_driver_testing_node_20
- image: rishabhpoddar/oauth-server-cicd
resource_class: large
parameters:
cdi-version:
Expand All @@ -39,6 +60,7 @@ jobs:
test-backend-sdk-testing:
docker:
- image: rishabhpoddar/supertokens_node_driver_testing_node_20
- image: rishabhpoddar/oauth-server-cicd
resource_class: large
parameters:
cdi-version:
Expand All @@ -57,6 +79,7 @@ jobs:
test-website:
docker:
- image: rishabhpoddar/supertokens_website_sdk_testing
- image: rishabhpoddar/oauth-server-cicd
resource_class: large
parameters:
fdi-version:
Expand All @@ -75,6 +98,7 @@ jobs:
test-authreact:
docker:
- image: rishabhpoddar/supertokens_website_sdk_testing_node_16
- image: rishabhpoddar/oauth-server-cicd
resource_class: large
parameters:
fdi-version:
Expand All @@ -100,10 +124,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)
Expand Down
22 changes: 22 additions & 0 deletions .circleci/configs/hydra.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
serve:
cookies:
same_site_mode: Lax

urls:
self:
issuer: http://localhost:4444
consent: http://localhost:3001/auth/oauth/consent
login: http://localhost:3001/auth/oauth/login
logout: http://localhost:3001/auth/oauth/logout

secrets:
system:
- youReallyNeedToChangeThis

oidc:
subject_identifiers:
supported_types:
- pairwise
- public
pairwise:
salt: youReallyNeedToChangeThis
32 changes: 24 additions & 8 deletions .circleci/doBackendSDKTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,33 @@ fi
coreDriverVersion=$1
coreDriverVersion=`echo $coreDriverVersion | tr -d '"'`

frontendDriverVersion=$2
frontendDriverVersion=`echo $2 | 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" ]]
coreFree="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
cat cdi-core-map.json
echo "coreDriverVersion: $coreDriverVersion"

coreBranchName=`cat cdi-core-map.json | jq -r '.["'$coreDriverVersion'"]'`
if [ "$coreBranchName" != "null" ]
then
coreFree=$coreDriverVersion
fi
fi

if [ "$coreFree" == "null" ]
then
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
Expand Down
30 changes: 23 additions & 7 deletions .circleci/doUnitTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,31 @@ 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" ]]
coreFree="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
cat cdi-core-map.json
echo "coreDriverVersion: $coreDriverVersion"

coreBranchName=`cat cdi-core-map.json | jq -r '.["'$coreDriverVersion'"]'`
if [ "$coreBranchName" != "null" ]
then
coreFree=$coreDriverVersion
fi
fi

if [ "$coreFree" == "null" ]
then
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
Expand Down
24 changes: 24 additions & 0 deletions .circleci/forceRunCI.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PAT=`cat .pat`
auth=`echo "${PAT}:\c" | base64 --wrap=0`

branch=`git rev-parse --abbrev-ref HEAD`

cdiCoreMap='{ "5.1": "feat/oauth-provider-base" }'
cdiPluginInterfaceMap='{ "5.1": "feat/oauth-provider-base" }'
fdiNodeMap='{ "3.1": "ci/manual_ci_runs", "4.0": "ci/manual_ci_runs" }'
fdiWebsiteMap='{ "1.17": "ci/support_custom_tags", "1.18": "ci/support_custom_tags", "1.19": "ci/support_custom_tags", "2.0": "ci/support_custom_tags", "3.0": "ci/support_custom_tags", "3.1": "ci/support_custom_tags", "4.0": "ci/support_custom_tags" }'
fdiAuthReactMap='{ "3.1": "feat/oauth2/examples", "4.0": "feat/oauth2/examples" }'

data=`jq -cn --arg branch "$branch" \
--arg cdiCoreMap "$cdiCoreMap" \
--arg cdiPluginInterfaceMap "$cdiPluginInterfaceMap" \
--arg fdiNodeMap "$fdiNodeMap" \
--arg fdiWebsiteMap "$fdiWebsiteMap" \
--arg fdiAuthReactMap "$fdiAuthReactMap" \
'{ branch: $ARGS.named.branch, parameters: { force: true, "cdi-core-map": $ARGS.named.cdiCoreMap, "cdi-plugin-interface-map": $ARGS.named.cdiPluginInterfaceMap, "fdi-node-map": $ARGS.named.fdiNodeMap, "fdi-website-map": $ARGS.named.fdiWebsiteMap, "fdi-auth-react-map": $ARGS.named.fdiAuthReactMap }}'`

curl --request POST \
--url 'https://circleci.com/api/v2/project/gh/supertokens/supertokens-node/pipeline' \
--header "authorization: Basic $auth" \
--header 'content-type: application/json' \
--data "$data"
Loading
Loading