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

feat: add shellcheck to circleci #2835

Merged
merged 12 commits into from
Nov 9, 2021
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ orbs:
go: circleci/go@1.5.0
prettier: ory/prettier@0.0.11
node: circleci/node@4.2.0
shellcheck: circleci/shellcheck@2.2.4

jobs:
# test-legacy-migrations:
Expand Down Expand Up @@ -61,6 +62,8 @@ jobs:
dir: docs/
- prettier/check:
dir: docs/
- shellcheck/install
- shellcheck/check
- goreleaser/install
- goreleaser/check
- golangci/install
Expand Down
1 change: 0 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ EOF
PROJECT_NAME="hydra"
OWNER=ory
REPO="hydra"
BINARY=hydra
Copy link
Contributor Author

@hirasawayuki hirasawayuki Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was an unused variable, so it was removed.
https://github.com/koalaman/shellcheck/wiki/SC2034

FORMAT=tar.gz
OS=$(uname_os)
ARCH=$(uname_arch)
Expand Down
3 changes: 2 additions & 1 deletion internal/certification/scripts/configure.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

source $HOME/.profile
# shellcheck disable=SC1091
source "$HOME"/.profile

hydra clients delete \
--endpoint http://localhost:9000 \
Expand Down
12 changes: 8 additions & 4 deletions internal/certification/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ sudo apt-get install -y nodejs
wget https://dl.google.com/go/go1.10.2.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.10.2.linux-amd64.tar.gz
mkdir -p go/bin
echo "export PATH=\$PATH:/usr/local/go/bin" >> $HOME/.profile
echo "GOPATH=\$HOME/go" >> $HOME/.profile
echo "export PATH=\$PATH:\$HOME/go" >> $HOME/.profile
source $HOME/.profile
{
echo "export PATH=\$PATH:/usr/local/go/bin"
echo "GOPATH=\$HOME/go"
echo "export PATH=\$PATH:\$HOME/go"
} >> "$HOME"/.profile

# shellcheck disable=SC1091
source "$HOME"/.profile

# go/dep
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
Expand Down
9 changes: 5 additions & 4 deletions internal/certification/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

source $HOME/.profile
# shellcheck disable=SC1091
source "$HOME"/.profile

domain=oidc-certification.ory.sh:8443
hydraport=9000
Expand All @@ -19,21 +20,21 @@ curl -i -X DELETE --url http://localhost:8001/apis/login-consent
curl -i -X POST \
--url http://localhost:8001/apis/ \
--data 'name=hydra-oauth' \
--data upstream_url=http://${ip}:9000/ \
--data upstream_url=http://"${ip}":9000/ \
--data 'uris=/oauth2,/.well-known,/userinfo,/clients' \
--data 'strip_uri=false' \
--data 'preserve_host=true'

curl -i -X POST \
--url http://localhost:8001/apis/ \
--data 'name=login-consent' \
--data upstream_url=http://$ip:9001/ \
--data upstream_url=http://"$ip":9001/ \
--data 'uris=/login,/consent' \
--data 'strip_uri=false' \
--data 'preserve_host=true'


(cd ./hydra-login-consent-node; HYDRA_URL=http://localhost:$hydraport PORT=$idport npm start &)
(cd ./hydra-login-consent-node || exit; HYDRA_URL=http://localhost:$hydraport PORT=$idport npm start &)

PORT=$hydraport \
OAUTH2_CONSENT_URL=https://$domain/consent \
Expand Down
9 changes: 5 additions & 4 deletions internal/certification/scripts/update.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash

source $HOME/.profile
# shellcheck disable=SC1091
source "$HOME"/.profile

go get -u -d github.com/ory/hydra
go get -d -u github.com/devopsfaith/krakend-examples/gin
(cd $HOME/hydra-login-consent-node; git pull -ff; npm i)
cd $HOME
(cd "$HOME"/hydra-login-consent-node || exit; git pull -ff; npm i)
cd "$HOME" || exit
go install github.com/ory/hydra
go install github.com/devopsfaith/krakend-examples/gin
go install github.com/devopsfaith/krakend-examples/gin
2 changes: 1 addition & 1 deletion scripts/run-bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ hydra clients create \
--endpoint http://localhost:9001

echo "Generating initial access tokens for token introspection benchmark"
authToken=$(hydra token client --endpoint http://localhost:9000 --client-id $clientId --client-secret $clientSecret)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was an unused variable, so it was removed.
https://github.com/koalaman/shellcheck/wiki/SC2034

introToken=$(hydra token client --endpoint http://localhost:9000 --client-id $clientId --client-secret $clientSecret)

cat >> BENCHMARKS.md << EOF
Expand Down Expand Up @@ -94,6 +93,7 @@ hey -n $numReqs -c $numParallel -m POST \
| tee -a BENCHMARKS.md


# shellcheck disable=SC2006
Copy link
Contributor Author

@hirasawayuki hirasawayuki Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set it to disable because it is a backtick that is written in markdown.
https://github.com/koalaman/shellcheck/wiki/SC2006

cat >> BENCHMARKS.md << EOF
\`\`\`

Expand Down
1 change: 1 addition & 0 deletions scripts/run-configuration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -Eeuxo pipefail

cd "$( dirname "${BASH_SOURCE[0]}" )/.."

# shellcheck disable=SC2006
cat > configuration.md << EOF
---
id: configuration
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/ssl/generate.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -euxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )"
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -euxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )/../.."

docker-compose -f quickstart.yml -f quickstart-postgres.yml -f test/conformance/docker-compose.yml up ${1:-} -d
docker-compose -f quickstart.yml -f quickstart-postgres.yml -f test/conformance/docker-compose.yml up "${1:-}" -d