Skip to content

Commit cd32a52

Browse files
authored
Add ignore-scripts argument sonarqube (#244)
* Fixing sonar hotspot * More sonar security hotspots * Use dummy transport proxy for the anms-core integration test
1 parent 8a541ed commit cd32a52

File tree

5 files changed

+49
-22
lines changed

5 files changed

+49
-22
lines changed

.github/workflows/anms-core.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,29 @@ jobs:
3535
env:
3636
ANMS_COMPOSE_OPTS: -f docker-compose.yml --profile light
3737
TEST_COMPOSE_OPTS: -f anms-core/integration_test/docker-compose.yml
38-
HOST_SOCKDIR: sockdir
39-
CTR_SOCKDIR: /var/tmp/nm
38+
HOST_SOCKDIR: /run/anms
4039
DOCKER_CMD: docker
4140
steps:
4241
- name: Checkout repository
4342
uses: actions/checkout@v4
4443
with:
4544
submodules: recursive
4645
- name: Build ANMS
47-
run: docker compose ${ANMS_COMPOSE_OPTS} build
46+
run: ${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} build
4847
- name: Build TEST
49-
run: docker compose ${TEST_COMPOSE_OPTS} build
48+
run: ${DOCKER_CMD} compose ${TEST_COMPOSE_OPTS} build
5049
- name: Build Volume
5150
run: |
5251
./create_volume.sh ./puppet/modules/apl_test/files/anms/tls
5352
sudo mkdir /run/anms
54-
- name: run
53+
- name: Start
5554
run: |
56-
docker compose ${ANMS_COMPOSE_OPTS} up -d --force-recreate --wait --wait-timeout 600
57-
docker compose ${TEST_COMPOSE_OPTS} run test-fixture
58-
- name: after_script
55+
${DOCKER_CMD} compose ${TEST_COMPOSE_OPTS} up -d test-transport
56+
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} up -d --force-recreate --wait --wait-timeout 600
57+
- name: Test
58+
run: ${DOCKER_CMD} compose ${TEST_COMPOSE_OPTS} run test-runner
59+
- name: Status
60+
if: failure()
5961
run: |
60-
if [ "${CI_JOB_STATUS}" = 'failed' ]; then
61-
docker logs anms-core
62-
fi
63-
62+
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} ps
63+
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} logs anms-core

.github/workflows/build-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
- name: Status
6161
if: always()
6262
run: |
63+
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} ps
6364
for BADSTATUS in stopped restarting; do
6465
${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} ps --services --filter status=${BADSTATUS} | tee -a /tmp/notgood
6566
done

anms-core/integration_test/docker-compose.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ networks:
2929

3030

3131
services:
32-
# External dependencies first
33-
test-fixture:
34-
hostname: test-fixture
32+
test-runner:
33+
hostname: test-runner
3534
build:
3635
context: ../..
3736
dockerfile: anms.Containerfile
@@ -40,3 +39,14 @@ services:
4039
- anms
4140
depends_on: {}
4241

42+
test-transport:
43+
hostname: test-transport
44+
build:
45+
context: ../..
46+
dockerfile: testenv.Containerfile
47+
target: socat-transport
48+
networks: {}
49+
depends_on: {}
50+
volumes:
51+
- "${HOST_SOCKDIR}:/var/tmp/anms"
52+
environment: {}

anms.Containerfile

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ ENV NODE_OPTIONS=--use-openssl-ca
9191
RUN --mount=type=cache,target=/var/cache/yum \
9292
dnf install -y https://rpm.nodesource.com/pub_16.x/el/9/x86_64/nodesource-release-el9-1.noarch.rpm && \
9393
dnf install -y nodejs && \
94-
npm install --global yarn && \
94+
npm install --ignore-scripts --global yarn && \
9595
yarn config set --global cafile ${PIP_CERT}
9696

9797

@@ -112,14 +112,14 @@ COPY --chown=${APP_USER}:${APP_USER} \
112112
anms-ui/server/package.json anms-ui/server/yarn.lock ${APP_WORK_DIR}/server/
113113
RUN --mount=type=cache,uid=9999,gid=9999,target=/home/${APP_USER}/.cache/yarn \
114114
cd ${APP_WORK_DIR}/server && \
115-
yarn install --immutable --immutable-cache
115+
yarn install --ignore-scripts --immutable --immutable-cache
116116

117117
# Install NodeJS UI Dependencies
118118
COPY --chown=${APP_USER}:${APP_USER} \
119119
anms-ui/public/package.json anms-ui/public/yarn.lock ${APP_WORK_DIR}/public/
120120
RUN --mount=type=cache,uid=9999,gid=9999,target=/home/${APP_USER}/.cache/yarn \
121121
cd ${APP_WORK_DIR}/public && \
122-
yarn install --immutable --immutable-cache
122+
yarn install --ignore-scripts --immutable --immutable-cache
123123

124124
# Build Backend/Frontend
125125
# These copies do not overwrite node_modules
@@ -129,7 +129,7 @@ RUN --mount=type=cache,uid=9999,gid=9999,target=/home/${APP_USER}/.cache/yarn \
129129
cd ${APP_WORK_DIR}/public && \
130130
yarn run build && \
131131
rm -rf ${APP_WORK_DIR}/public/node_modules && \
132-
yarn install --immutable --immutable-cache --production
132+
yarn install --ignore-scripts --immutable --immutable-cache --production
133133

134134
COPY --chmod=755 anms-ui/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
135135
ENTRYPOINT ["docker-entrypoint"]
@@ -286,9 +286,11 @@ ENV PIP_CERT=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
286286
ENV PIP_DEFAULT_TIMEOUT=300
287287

288288

289-
RUN dnf install -y epel-release && \
289+
RUN --mount=type=cache,target=/var/cache/yum \
290+
dnf install -y epel-release && \
290291
crb enable
291-
RUN dnf install -y \
292+
RUN --mount=type=cache,target=/var/cache/yum \
293+
dnf install -y \
292294
gcc g++ \
293295
cmake ninja-build ruby pkg-config \
294296
flex libfl-static bison pcre2-devel civetweb civetweb-devel openssl-devel cjson-devel libpq-devel systemd-devel && \
@@ -350,7 +352,8 @@ RUN cd /usr/local/src/nm && \
350352
# Runtime image for REFDM
351353
FROM anms-base AS amp-manager
352354

353-
RUN dnf install -y https://download.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
355+
RUN --mount=type=cache,target=/var/cache/yum \
356+
dnf install -y https://download.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
354357
crb enable && \
355358
dnf install -y \
356359
pcre2 civetweb openssl-libs cjson libpq

testenv.Containerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,16 @@ EXPOSE 4556/udp
185185

186186
HEALTHCHECK --start-period=10s --interval=30s --timeout=5s --retries=5 \
187187
CMD ["service_is_running", "ion", "refda-ion"]
188+
189+
190+
# This image provides a very simple socat-baseed transport proxy.
191+
#
192+
FROM registry.access.redhat.com/ubi9/ubi:9.2 AS socat-transport
193+
194+
RUN --mount=type=cache,target=/var/cache/yum \
195+
dnf install -y https://download.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
196+
crb enable && \
197+
dnf install -y \
198+
socat
199+
200+
CMD ["socat", "-x", "stdio", "UNIX-LISTEN:/var/tmp/anms/proxy.sock,socktype=5,forever"]

0 commit comments

Comments
 (0)