diff --git a/.devcontainer/swift/Dockerfile b/.devcontainer/swift/Dockerfile index e597a56e083..9b43eaf4f34 100644 --- a/.devcontainer/swift/Dockerfile +++ b/.devcontainer/swift/Dockerfile @@ -5,4 +5,5 @@ FROM mcr.microsoft.com/vscode/devcontainers/cpp:0-ubuntu-22.04 USER root ADD root.sh /tmp/root.sh +ADD update-codeql.sh /usr/local/bin/update-codeql RUN bash /tmp/root.sh && rm /tmp/root.sh diff --git a/.devcontainer/swift/root.sh b/.devcontainer/swift/root.sh index 98c64bcfad7..5f9648ce3e8 100644 --- a/.devcontainer/swift/root.sh +++ b/.devcontainer/swift/root.sh @@ -17,3 +17,6 @@ curl -fSsL -o /usr/local/bin/bazelisk https://github.com/bazelbuild/bazelisk/rel echo "${BAZELISK_DOWNLOAD_SHA} */usr/local/bin/bazelisk" | sha256sum --check - chmod 0755 /usr/local/bin/bazelisk ln -s bazelisk /usr/local/bin/bazel + +# install latest codeql +update-codeql diff --git a/.devcontainer/swift/update-codeql.sh b/.devcontainer/swift/update-codeql.sh new file mode 100755 index 00000000000..2e4990273e6 --- /dev/null +++ b/.devcontainer/swift/update-codeql.sh @@ -0,0 +1,14 @@ +#!/bin/bash -e + +URL=https://github.com/github/codeql-cli-binaries/releases +LATEST_VERSION=$(curl -L -s -H 'Accept: application/json' $URL/latest | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') +CURRENT_VERSION=v$(codeql version 2>/dev/null | sed -ne 's/.*release \([0-9.]*\)\./\1/p') +if [[ $CURRENT_VERSION != $LATEST_VERSION ]]; then + curl -fSqL -o /tmp/codeql.zip $URL/download/$LATEST_VERSION/codeql-linux64.zip + unzip /tmp/codeql.zip -qd /opt + rm /tmp/codeql.zip + ln -sf /opt/codeql/codeql /usr/local/bin/codeql + echo installed version $LATEST_VERSION +else + echo current version $CURRENT_VERSION is up-to-date +fi diff --git a/.devcontainer/swift/user.sh b/.devcontainer/swift/user.sh index 31f727872ba..fbf8aca57a7 100755 --- a/.devcontainer/swift/user.sh +++ b/.devcontainer/swift/user.sh @@ -11,5 +11,3 @@ bazel run swift/create-extractor-pack #install and set up pre-commit python3 -m pip install pre-commit --no-warn-script-location $HOME/.local/bin/pre-commit install - -cat $(dirname $0)/user_bashrc.sh >> $HOME/.bashrc diff --git a/.devcontainer/swift/user_bashrc.sh b/.devcontainer/swift/user_bashrc.sh deleted file mode 100644 index 5b0c9141fa9..00000000000 --- a/.devcontainer/swift/user_bashrc.sh +++ /dev/null @@ -1,5 +0,0 @@ -# have the codeql binary installed by vscode automatically in PATH -bin=$(ls $HOME/.vscode-remote/data/User/globalStorage/github.vscode-codeql/*/codeql/codeql -t 2>/dev/null | head -1) -if [[ -n $bin ]]; then - export PATH=$PATH:$(dirname "$bin") -fi