Skip to content

Commit

Permalink
Update to v4 checkout action and address warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
wkoot committed Feb 13, 2024
1 parent e9505d4 commit b8a8448
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- env:
IMAGE_EDITION: developer
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Build the Docker image
run: docker build --build-arg="IMAGE_EDITION=${{ matrix.env.IMAGE_EDITION }}" -t ci .
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apt-get update \
&& apt-get install -y wget curl ca-certificates-java jq postgresql-client \
&& rm -rf /var/lib/apt/lists/*

ADD ./plugins /tmp/plugins
COPY ./plugins /tmp/plugins
RUN rm -rf ./extensions/plugins/* && \
cat /tmp/plugins/plugin-list && \
chmod +x /tmp/plugins/install-plugins.sh && \
Expand All @@ -27,8 +27,8 @@ RUN rm -rf ./extensions/plugins/* && \
WORKDIR /opt/sonarqube

COPY ./start-with-profile.sh .
ADD ./rules /tmp/rules
ADD sonar.properties /opt/sonarqube/conf/sonar.properties
COPY ./rules /tmp/rules
COPY sonar.properties /opt/sonarqube/conf/sonar.properties

RUN chown -R sonarqube:sonarqube . \
&& chmod +x start-with-profile.sh
Expand Down
17 changes: 10 additions & 7 deletions plugins/install-plugins.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
#!/bin/bash

cwd="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
plugin_dir=/opt/sonarqube/extensions/plugins
plugin_dir="/opt/sonarqube/extensions/plugins"

# Download plugins
while read plugin; do
wget $plugin -P $plugin_dir
while read -r plugin; do
wget --no-verbose "${plugin}" -P "${plugin_dir}"
rtn=$?
if [ $rtn -ne 0 ]; then
echo "Error downloading $plugin"
echo "Error downloading ${plugin}"
exit $rtn
fi
done < $cwd/plugin-list
done < "${cwd}"/plugin-list

# Check if unzip required
for file in $plugin_dir/*; do
if [[ $file =~ \.zip$ ]]; then unzip $file -d $plugin_dir && rm -f $file; fi
for file in "${plugin_dir}"/*; do
if [[ $file =~ \.zip$ ]]; then
unzip "${file}" -d "${plugin_dir}"
rm -f "${file}"
fi
done
4 changes: 2 additions & 2 deletions start-with-profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function processRule {
# Enable rules by group (types)
if [[ "${ruleSet}" =~ types=.* ]]; then

IFS='=' read -r typekey ruleTypes <<< "${ruleSet}"
IFS='=' read -r _ ruleTypes <<< "${ruleSet}"
if [ "${operationType}" == "+" ]; then
echo "Activating rules ${ruleTypes} for ${language}"
curlAdmin -X POST "${BASE_URL}/api/qualityprofiles/activate_rules?targetKey=${profileKey}&languages=${language}&types=${ruleTypes}&statuses=READY"
Expand Down Expand Up @@ -167,7 +167,7 @@ function createProfile {

if [[ -f "${rulesFilename}" ]]; then
# activate and deactivate rules in new profile
while read ruleLine || [ -n "${line}" ]; do
while read -r ruleLine || [ -n "${line}" ]; do

# Each line contains:
# (+|-)types=comma-seperated,list-of-types # comment
Expand Down

0 comments on commit b8a8448

Please sign in to comment.