From fb7e76d5bf84f23c82b4baf0278af029348aef87 Mon Sep 17 00:00:00 2001 From: Simon Garnotel Date: Fri, 18 Mar 2022 10:07:14 +0100 Subject: [PATCH] shellcheck & cleanup [ci skip] --- .gitignore | 4 ++-- .jenkins/build.sh | 3 +-- .jenkins/clean.sh | 6 +++--- .jenkins/deploy.sh | 16 ++++++++-------- .jenkins/deployDockerHub.sh | 8 ++++---- freefem-docker/Dockerfile => Dockerfile | 0 freefem-docker/build.sh => build.sh | 0 7 files changed, 18 insertions(+), 19 deletions(-) rename freefem-docker/Dockerfile => Dockerfile (100%) rename freefem-docker/build.sh => build.sh (100%) diff --git a/.gitignore b/.gitignore index 9decaad..f97892c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -freefem-docker/ff++-compiled -freefem-docker/freefem.tar.gz +ff++-compiled +freefem.tar.gz build diff --git a/.jenkins/build.sh b/.jenkins/build.sh index d8ba5c6..4865320 100644 --- a/.jenkins/build.sh +++ b/.jenkins/build.sh @@ -1,5 +1,4 @@ #!/bin/bash -cd freefem-docker \ - && chmod +x ./build.sh \ +chmod +x ./build.sh \ && ./build.sh diff --git a/.jenkins/clean.sh b/.jenkins/clean.sh index 50b9d90..8a94207 100644 --- a/.jenkins/clean.sh +++ b/.jenkins/clean.sh @@ -1,5 +1,5 @@ #!/bin/bash -sudo docker container stop $(sudo docker container ls -aq) -sudo docker container rm $(sudo docker container ls -aq) -sudo docker rmi $(sudo docker images -q) +sudo docker container stop "$(sudo docker container ls -aq)" +sudo docker container rm "$(sudo docker container ls -aq)" +sudo docker rmi "$(sudo docker images -q)" diff --git a/.jenkins/deploy.sh b/.jenkins/deploy.sh index 727857a..e90ab00 100644 --- a/.jenkins/deploy.sh +++ b/.jenkins/deploy.sh @@ -18,16 +18,16 @@ FILE_NAME='freefem.tar.gz' # Get the current release number from sources SOURCE_REPOSITORY='FreeFem-sources' -CURRENT_VERSION=`curl 'https://api.github.com/repos/'$ORGANIZATION'/'$SOURCE_REPOSITORY'/releases/latest' | jq -r '.tag_name'` +CURRENT_VERSION=$(curl "https://api.github.com/repos/$ORGANIZATION/$SOURCE_REPOSITORY/releases/latest" | jq -r '.tag_name') -echo 'Current FreeFEM version: '$CURRENT_VERSION +echo "Current FreeFEM version: $CURRENT_VERSION" # Create the release (keep the upload url) -RELEASE_PARAMETERS=$(printf '{"tag_name": "%s", "target_commitish": "master", "name": "%s", "body": "FreeFEM docker - FreeFEM %s.", "draft": false, "prerelease": false}' $CURRENT_VERSION $CURRENT_VERSION $CURRENT_VERSION) -RELEASE=`curl -H "Authorization: token $TOKEN" --data "$RELEASE_PARAMETERS" 'https://api.github.com/repos/'$ORGANIZATION'/'$REPOSITORY'/releases'` -UPLOAD_URL=`echo $RELEASE | jq -r '.upload_url'` -echo 'Upload URL: '$UPLOAD_URL +RELEASE_PARAMETERS=$(printf '{"tag_name": "%s", "target_commitish": "master", "name": "%s", "body": "FreeFEM docker - FreeFEM %s.", "draft": false, "prerelease": false}' "$CURRENT_VERSION" "$CURRENT_VERSION" "$CURRENT_VERSION") +RELEASE=$(curl -H "Authorization: token $TOKEN" --data "$RELEASE_PARAMETERS" "https://api.github.com/repos/$ORGANIZATION/$REPOSITORY/releases") +UPLOAD_URL=$(echo "$RELEASE" | jq -r '.upload_url') +echo "Upload URL: $UPLOAD_URL" # Upload asset -RESPONSE=`curl --data-binary "@$FILE_NAME" -H "Authorization: token $TOKEN" -H "Content-Type: application/octet-stream" "$UPLOAD_URL=$FILE_NAME"` -echo 'Server response: '$RESPONSE +RESPONSE=$(curl --data-binary "@$FILE_NAME" -H "Authorization: token $TOKEN" -H "Content-Type: application/octet-stream" "$UPLOAD_URL=$FILE_NAME") +echo "Server response: $RESPONSE" diff --git a/.jenkins/deployDockerHub.sh b/.jenkins/deployDockerHub.sh index bcfeed3..be93d94 100644 --- a/.jenkins/deployDockerHub.sh +++ b/.jenkins/deployDockerHub.sh @@ -1,17 +1,17 @@ #!/bin/bash # Login -docker login -u sgarnotel -p $DOCKER_TOKEN +docker login -u sgarnotel -p "$DOCKER_TOKEN" # Get the current release number from sources ORGANIZATION='FreeFem' SOURCE_REPOSITORY='FreeFem-sources' -CURRENT_VERSION=`curl 'https://api.github.com/repos/'$ORGANIZATION'/'$SOURCE_REPOSITORY'/releases/latest' | jq -r '.tag_name'` +CURRENT_VERSION=$(curl "https://api.github.com/repos/$ORGANIZATION/$SOURCE_REPOSITORY/releases/latest" | jq -r '.tag_name') # Tag docker tag freefem:latest freefem/freefem:latest -docker tag freefem:latest freefem/freefem:$CURRENT_VERSION +docker tag freefem:latest freefem/freefem:"$CURRENT_VERSION" # Push docker push freefem/freefem:latest -docker push freefem/freefem:$CURRENT_VERSION +docker push freefem/freefem:"$CURRENT_VERSION" diff --git a/freefem-docker/Dockerfile b/Dockerfile similarity index 100% rename from freefem-docker/Dockerfile rename to Dockerfile diff --git a/freefem-docker/build.sh b/build.sh similarity index 100% rename from freefem-docker/build.sh rename to build.sh