diff --git a/localinstall/.env-api b/localinstall/.env-api index 5cfb5ea..f419f50 100644 --- a/localinstall/.env-api +++ b/localinstall/.env-api @@ -1,4 +1,4 @@ -SECRET_KEY=b6451545d2e4635148d768f07877aade3ad8e7e160d52962badd7587a4b9a150 +#SECRET_KEY= #algorithm= #access_token_expire_minutes= SMTP_HOST=localhost diff --git a/localinstall/1-rebuild_all.sh b/localinstall/1-rebuild_all.sh index 7ad8982..a1ebf0a 100755 --- a/localinstall/1-rebuild_all.sh +++ b/localinstall/1-rebuild_all.sh @@ -98,12 +98,18 @@ failonerror echo Build docker images: pipeline ./kci docker $args kernelci pipeline --version="$pipeline_rev" failonerror +echo Build docker images: lava-callback +./kci docker $args kernelci lava-callback --version="$pipeline_rev" +failonerror echo Tag docker image of api to latest docker tag local/staging-kernelci:api-$api_rev local/staging-kernelci:api failonerror echo Tag docker image of pipeline to latest docker tag local/staging-kernelci:pipeline-$pipeline_rev local/staging-kernelci:pipeline failonerror +echo Tag docker image of lava-callback to latest +docker tag local/staging-kernelci:lava-callback-$pipeline_rev local/staging-kernelci:lava-callback +failonerror echo Build docker images: clang-17+kselftest+kernelci for x86 ./kci docker $args clang-17 kselftest kernelci --arch x86 failonerror diff --git a/localinstall/2-install_api.sh b/localinstall/2-install_api.sh index 102d3a5..d87b97e 100755 --- a/localinstall/2-install_api.sh +++ b/localinstall/2-install_api.sh @@ -20,6 +20,8 @@ cp .env-api kernelci/kernelci-api/.env cp api-configs.yaml kernelci/kernelci-core/config/core/ cp kernelci-cli.toml kernelci/kernelci-core/kernelci.toml +sed -i "s/#SECRET_KEY=/SECRET_KEY=${API_SECRET_KEY}/" kernelci/kernelci-api/.env + cd kernelci/kernelci-api mkdir -p docker/redis/data ${SUDO} chmod -R 0777 docker/storage/data diff --git a/localinstall/3-install_pipeline.sh b/localinstall/3-install_pipeline.sh index f54a2e5..573e2a9 100755 --- a/localinstall/3-install_pipeline.sh +++ b/localinstall/3-install_pipeline.sh @@ -17,9 +17,6 @@ tail -n +$((line+1)) kernelci/kernelci-pipeline/config/pipeline.yaml >> tmp.yaml mv tmp.yaml kernelci/kernelci-pipeline/config/pipeline.yaml } -# replace in pipeline.yaml http://172.17.0.1:8001 to http://localhost:8001 -sed -i 's/http:\/\/172.17.0.1:8001/http:\/\/host.docker.internal:8001/g' kernelci/kernelci-pipeline/config/pipeline.yaml - # TODO: Check if this is already done #append_storage @@ -52,7 +49,7 @@ sed -i "s|- '/data/kernelci-deploy-checkout/kernelci-pipeline/data/ssh/|- '$PIPE sed -i "s|- '/data/kernelci-deploy-checkout/kernelci-pipeline/data/output/|- '$PIPELINE_PWD/data/output/|g" config/pipeline.yaml # set 777 to data/output and data/ssh (TODO: or set proper uid, kernelci is 1000?) -chmod -R 777 data +chmod -R 777 data/output chmod 777 data/ssh cp ../../ssh.key data/ssh/id_rsa_tarball chown 1000:1000 data/ssh/id_rsa_tarball @@ -94,3 +91,13 @@ echo "KCI_API_TOKEN=${API_TOKEN}" >> .env echo "API_TOKEN=${API_TOKEN}" >> .env cp .env kernelci/kernelci-pipeline/.docker-env mv .env kernelci/kernelci-pipeline/.env + +# Add JWT section with the secret key to kernelci.toml for pipeline callback +sed -i 's/#\[jwt\]$/[jwt]/' kernelci/kernelci-pipeline/config/kernelci.toml +sed -i 's/#secret = "SomeSecretString"/secret = "'"${PIPELINE_SECRET_KEY}"'"/' kernelci/kernelci-pipeline/config/kernelci.toml +# Generate kci-dev token +pip install pyjwt +TOKEN=$(kernelci/kernelci-pipeline/tools/jwt_generator.py --toml kernelci/kernelci-pipeline/config/kernelci.toml \ +--email ${YOUR_EMAIL} --permissions checkout,testretry,patchset | grep "JWT token:" | cut -d' ' -f3) +echo $TOKEN > kci-dev-token.txt +echo "kci-dev token saved to kci-dev-token.txt" diff --git a/localinstall/4-start-cycle.sh b/localinstall/4-start-cycle.sh index caca6d4..36887dc 100755 --- a/localinstall/4-start-cycle.sh +++ b/localinstall/4-start-cycle.sh @@ -12,6 +12,7 @@ fi cd kernelci/kernelci-pipeline ${DOCKER_COMPOSE} down ${DOCKER_COMPOSE} up -d + echo "You can view now logs of containers using docker logs -f or docker-compose logs -f in kernelci/kernelci-pipeline or kernelci/kernelci-api directories" echo "Also you can do docker ps to see running containers, and in case of ongoing builds, you can view their logs too by docker logs -f " echo "You can also open API viewer at http://127.0.0.1:8001/viewer" diff --git a/localinstall/main.cfg b/localinstall/main.cfg index 7178c95..531310d 100755 --- a/localinstall/main.cfg +++ b/localinstall/main.cfg @@ -8,4 +8,6 @@ KCI_PIPELINE_BRANCH=staging.kernelci.org YOUR_EMAIL=denys.f@collabora.com ADMIN_PASSWORD="Ch4n93m3HpL33z" STORAGE_TOKEN="FKDFLKJFLKDJFLK" +PIPELINE_SECRET_KEY="0123456789" +API_SECRET_KEY="9876543210" #KCI_CACHE=1