49
49
- name : Stand up Devcontainer
50
50
shell : bash
51
51
run : |
52
-
53
52
devcontainer up --workspace-folder ${PWD} \
54
53
--workspace-mount-consistency cached \
55
54
--id-label devcontainer.local_folder=${PWD} \
@@ -60,26 +59,39 @@ jobs:
60
59
--update-remote-user-uid-default on \
61
60
--mount-workspace-git-root true
62
61
echo $?
63
-
62
+
64
63
- name : install-codeql
65
64
shell : bash
66
65
run : |
67
- echo "Determine the latest release version of CodeQL CLI"
68
- docker exec hostsvc-link bash -c "LATEST_RELEASE=$(curl -s https://api.github.com/repos/github/codeql-cli-binaries/releases/latest | grep \"tag_name\" | awk '{print substr($2, 2, length($2)-3)}')"
66
+ CONTAINER_NAME="hostsvc-link"
69
67
70
- echo "Create target directory if it doesn't exist"
71
- docker exec hostsvc-link bash -c "mkdir -p \"${{ github.workspace }}/codeql\""
68
+ # Determine the latest release version of CodeQL CLI
69
+ docker exec $CONTAINER_NAME bash -c "curl -s https://api.github.com/repos/github/codeql-cli-binaries/releases/latest | grep 'tag_name' | awk '{print substr(\$2, 2, length(\$2)-3)}'" > latest_release.txt
70
+ LATEST_RELEASE=$(<latest_release.txt)
72
71
73
- echo "Download the latest release of CodeQL CLI"
72
+ # Define the download URL and target directory
73
+ DOWNLOAD_URL="https://github.com/github/codeql-cli-binaries/releases/download/${LATEST_RELEASE}/codeql-linux64.zip"
74
+ TARGET_DIR="/root/codeql" # Adjust the target directory as per the container's file system
75
+ ZIP_FILE="$TARGET_DIR/codeql.zip"
76
+
77
+ # Create target directory if it doesn't exist
78
+ docker exec $CONTAINER_NAME bash -c "mkdir -p $TARGET_DIR"
79
+
80
+ # Download the latest release of CodeQL CLI
74
81
echo "Downloading CodeQL CLI ${LATEST_RELEASE}..."
75
- docker exec hostsvc-link bash -c "curl -L \"https://github.com/github/codeql-cli-binaries/releases/download/${LATEST_RELEASE}/codeql-linux64.zip\" -o \"${{ github.workspace }}/codeql/codeql.zip\" "
82
+ docker exec $CONTAINER_NAME bash -c "curl -L '$DOWNLOAD_URL' -o '$ZIP_FILE' "
76
83
77
- echo " Extract the downloaded zip file"
84
+ # Extract the downloaded zip file
78
85
echo "Extracting CodeQL CLI..."
79
- docker exec hostsvc-link bash -c "unzip -o \"${{ github.workspace }}/codeql/codeql.zip\" -d \"${{ github.workspace }}/codeql\""
86
+ docker exec $CONTAINER_NAME bash -c "unzip -o '$ZIP_FILE' -d '$TARGET_DIR'"
87
+
88
+ # Clean up the zip file
89
+ docker exec $CONTAINER_NAME bash -c "rm '$ZIP_FILE'"
80
90
81
- echo "Clean up the zip file"
82
- docker exec hostsvc-link bash -c "rm \"${{ github.workspace }}/codeql/codeql.zip\""
91
+ # Optionally, add CodeQL CLI to PATH by adding it to .bashrc or .bash_profile
92
+ # Note: This step might need adjustments based on the container's shell configuration
93
+ docker exec $CONTAINER_NAME bash -c "echo 'export PATH=\$PATH:$TARGET_DIR/codeql' >> /root/.bashrc"
94
+ docker exec $CONTAINER_NAME bash -c "source /root/.bashrc"
83
95
84
96
echo "CodeQL CLI installation completed."
85
97
0 commit comments