From 4e54269d1c3d8549209a1134e5253582b9764882 Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Tue, 8 Apr 2025 12:34:07 +0200 Subject: [PATCH 1/4] fix: keep 'host.docker.internal' as '172.17.0.1' for compatibility with linux systems in pipeline.yaml Signed-off-by: Simone Tollardo --- localinstall/3-install_pipeline.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/localinstall/3-install_pipeline.sh b/localinstall/3-install_pipeline.sh index f54a2e5..8cd277e 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 From 4bc633e069c7ec2719600750d8af547eaf7ba25c Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Tue, 8 Apr 2025 12:37:41 +0200 Subject: [PATCH 2/4] feat: add pipeline callback to local deployment Signed-off-by: Simone Tollardo --- localinstall/.env-api | 2 +- localinstall/2-install_api.sh | 2 ++ localinstall/3-install_pipeline.sh | 10 ++++++++++ localinstall/4-start-cycle.sh | 1 + localinstall/main.cfg | 2 ++ 5 files changed, 16 insertions(+), 1 deletion(-) 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/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 8cd277e..1ac5f5a 100755 --- a/localinstall/3-install_pipeline.sh +++ b/localinstall/3-install_pipeline.sh @@ -91,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 From 2cd87b44ce5cd89f5e5a7e16d01a6b9f29bab702 Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 10 Apr 2025 17:13:27 +0200 Subject: [PATCH 3/4] fix: build lava-callback container images using kci-core Signed-off-by: Simone Tollardo --- localinstall/1-rebuild_all.sh | 6 ++++++ 1 file changed, 6 insertions(+) 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 From df31554ed0a4dc42e5fff945a0d5bfb763a27993 Mon Sep 17 00:00:00 2001 From: Simone Tollardo Date: Thu, 10 Apr 2025 19:15:44 +0200 Subject: [PATCH 4/4] Fix: fix volume container permissions Signed-off-by: Simone Tollardo --- localinstall/3-install_pipeline.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localinstall/3-install_pipeline.sh b/localinstall/3-install_pipeline.sh index 1ac5f5a..573e2a9 100755 --- a/localinstall/3-install_pipeline.sh +++ b/localinstall/3-install_pipeline.sh @@ -49,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