Skip to content

Commit 6d9c89d

Browse files
tests/integration: fetch library source reference and use builder step to build binaries
Signed-off-by: Michael Valdron <[email protected]>
1 parent d8010a1 commit 6d9c89d

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

tests/integration/Dockerfile

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
FROM registry.access.redhat.com/ubi8/go-toolset:1.21.13-1.1727869850 AS builder
16+
ARG LIBRARY_REPO="https://github.com/devfile/registry-support"
17+
ARG LIBRARY_REF="main"
18+
USER root
19+
WORKDIR /registry-test
20+
21+
COPY . .
22+
23+
# Fetch library repository
24+
RUN git clone ${LIBRARY_REPO} -b ${LIBRARY_REF} /registry-support
25+
26+
# Build the registry library and add to builder path
27+
RUN cd /registry-support/registry-library && ./build.sh && cp /registry-support/registry-library/registry-library /usr/local/bin/registry-library
28+
29+
# Build the test binary
30+
RUN /registry-test/build.sh
31+
1532
FROM registry.access.redhat.com/ubi8/ubi-minimal AS license
1633
ARG LICENSE_REPO="devfile/registry-support"
1734
ARG LICENSE_REF="main"
@@ -21,17 +38,15 @@ USER root
2138
RUN mkdir -p /licenses
2239
RUN curl -sL https://raw.githubusercontent.com/${LICENSE_REPO}/refs/heads/${LICENSE_REF}/LICENSE -o /licenses/LICENSE
2340

24-
FROM registry.access.redhat.com/ubi8/go-toolset:1.21.13-1.1727869850
41+
FROM registry.access.redhat.com/ubi8/ubi-minimal
2542
USER root
2643
WORKDIR /registry-test
2744

28-
COPY . .
45+
# Add registry library to runner path
46+
COPY --from=builder /usr/local/bin/registry-library /usr/local/bin/registry-library
2947

30-
# Build the registry library and add to path
31-
RUN cd /registry-test/registry-library && ./build.sh && cp /registry-test/registry-library/registry-library /usr/local/bin/registry-library
32-
33-
# Build the test binary
34-
RUN /registry-test/build.sh
48+
# Add test binary to working directory of runner
49+
COPY --from=builder /registry-test/devfile-registry-integration /registry-test/devfile-registry-integration
3550

3651
# Add license
3752
RUN mkdir -p /licenses

tests/integration/docker-build.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@
1818
#set the docker alias if necessary
1919
. ../../setenv.sh
2020

21+
# Devfile Registry library build arguments
22+
LIBRARY_REPO=${LIBRARY_REPO:-"https://github.com/devfile/registry-support"}
23+
LIBRARY_REF=${LIBRARY_REF:-"main"}
24+
2125
# LICENSE build arguments
2226
LICENSE_REPO=${LICENSE_REPO:-"devfile/registry-support"}
2327
LICENSE_REF=${LICENSE_REF:-"main"}
2428

25-
# Get the registry-library
26-
cp -rf ../../registry-library ./
27-
2829
# Build the container image
2930
docker build -t devfile-registry-integration \
31+
--build-arg LIBRARY_REPO=${LIBRARY_REPO} \
32+
--build-arg LIBRARY_REF=${LIBRARY_REF} \
3033
--build-arg LICENSE_REPO=${LICENSE_REPO} \
3134
--build-arg LICENSE_REF=${LICENSE_REF} ./
32-
33-
rm -rf ./registry-library/

0 commit comments

Comments
 (0)