From 925feee03f4d6d273439c9f12364de1a270a7f41 Mon Sep 17 00:00:00 2001 From: david sewell Date: Tue, 30 Mar 2021 12:27:08 +0000 Subject: [PATCH] container-structure-tests --- Dockerfile | 17 ++++++++++++----- tests/container-structure-tests.yml | 22 ++++++++++++++++------ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7f8afef..7e70070 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,10 +14,15 @@ ARG GLIBC_VERSION USER 0 RUN yum -y install https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-${RHEL_ENDPOINT_VERSION}.x86_64.rpm \ && yum -y install git-${GIT_VERSION} \ - && yum -y install libgcc.i686-${GCC_VERSION} \ - libgcc-c++.i686-${GCC_VERSION} \ - glibc-devel.i686-${GLIBC_VERSION} \ - libstdc++-devel.i686-${GCC_VERSION} \ + && yum -y install libgcc-${GCC_VERSION} \ + libgcc-c++-${GCC_VERSION} \ + glibc-devel-${GLIBC_VERSION} \ + libstdc++-devel-${GCC_VERSION} \ + --setopt=protected_multilib=false \ + && yum -y install libgcc-${GCC_VERSION}.i686 \ + libgcc-c++-${GCC_VERSION}.i686 \ + glibc-devel-${GLIBC_VERSION}.i686 \ + libstdc++-devel-${GCC_VERSION}.i686 \ --setopt=protected_multilib=false \ && yum clean all USER 1001 @@ -31,7 +36,9 @@ USER 0 RUN groupadd --gid 5001 nonroot \ # user needs a home folder to store azure credentials && useradd --gid nonroot --create-home --uid 5001 nonroot \ - && chown nonroot:nonroot /workspace + && chown nonroot:nonroot /workspace \ + && chmod 755 /home/nonroot \ + && chmod 755 /workspace USER nonroot CMD ["bash"] diff --git a/tests/container-structure-tests.yml b/tests/container-structure-tests.yml index 346df92..c8093a4 100644 --- a/tests/container-structure-tests.yml +++ b/tests/container-structure-tests.yml @@ -11,25 +11,35 @@ commandTests: - name: "Check Python version" command: "python" args: ["--version"] - expectedOutput: ["Python 2.7.5"] + expectedError: ["Python 2.7.5"] - name: "Check Git version" command: "git" args: ["--version"] - expectedOutput: ["git version 1.8.3.1"] + expectedOutput: ["git version 2.30.1"] + + - name: "Check GCC version" + command: "gcc" + args: ["--version"] + expectedOutput: ["Red Hat 7.3.1-5"] + + - name: "Check G++ version" + command: "g++" + args: ["--version"] + expectedOutput: ["Red Hat 7.3.1-5"] fileExistenceTests: - name: 'Check nonroot user home' path: '/home/nonroot' shouldExist: true permissions: 'drwxr-xr-x' - uid: 1001 - gid: 1001 + uid: 5001 + gid: 5001 isExecutableBy: 'group' - name: 'Check nonroot user rights on /workspace folder' path: '/workspace' shouldExist: true permissions: 'drwxr-xr-x' - uid: 1001 - gid: 1001 + uid: 5001 + gid: 5001 isExecutableBy: 'group'