From faab179502cad45a0767b63f904b1ae4dcdbaad9 Mon Sep 17 00:00:00 2001 From: Imran Ali <101260174+justiceia@users.noreply.github.com> Date: Mon, 15 Jul 2024 09:53:23 +0100 Subject: [PATCH] FACT-1881 change images to imported ones (#2568) * poke with readme change * changed db image name to imported and test container one, still need to do sftp image * jenkinsfiles adding imported line * added last little line for sftp docker change --- Jenkinsfile_CNP | 2 ++ Jenkinsfile_nightly | 2 ++ README.md | 1 - docker/database/Dockerfile | 2 +- docker/sftp/Dockerfile | 2 +- .../util/TestUploadStorageHelper.java | 23 +++++++++++-------- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile_CNP b/Jenkinsfile_CNP index 00343f9b9..81ba9f862 100644 --- a/Jenkinsfile_CNP +++ b/Jenkinsfile_CNP @@ -11,6 +11,8 @@ def component = "send-letter-service" def channel = '#bsp-build-notices' +env.TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX = 'hmctspublic.azurecr.io/imported/' + secrets = [ 's2s-${env}': [ secret('microservicekey-send-letter-tests', 'TEST_S2S_SECRET') diff --git a/Jenkinsfile_nightly b/Jenkinsfile_nightly index f459970c8..569dacdd8 100644 --- a/Jenkinsfile_nightly +++ b/Jenkinsfile_nightly @@ -13,6 +13,8 @@ def component = "send-letter-service" def channel = '#bsp-build-notices' +env.TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX = 'hmctspublic.azurecr.io/imported/' + secrets = [ 's2s-${env}': [ secret('microservicekey-send-letter-tests', 'TEST_S2S_SECRET') diff --git a/README.md b/README.md index edc565a24..8513462a0 100644 --- a/README.md +++ b/README.md @@ -232,4 +232,3 @@ A letter can be in one of the following statuses: ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details - diff --git a/docker/database/Dockerfile b/docker/database/Dockerfile index 0e6f184bb..1c4047cee 100644 --- a/docker/database/Dockerfile +++ b/docker/database/Dockerfile @@ -1,4 +1,4 @@ -FROM postgres:16 +FROM hmctspublic.azurecr.io/imported/postgres:16-alpine MAINTAINER "HMCTS BSP " LABEL maintainer = "HMCTS BSP " diff --git a/docker/sftp/Dockerfile b/docker/sftp/Dockerfile index 6536d3303..9b46bf5fb 100644 --- a/docker/sftp/Dockerfile +++ b/docker/sftp/Dockerfile @@ -1,4 +1,4 @@ -FROM atmoz/sftp:alpine +FROM hmctspublic.azurecr.io/imported/atmoz/sftp:alpine COPY keys/keypair.pub /home/sftp/.ssh/keys/keypair.pub COPY keys/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/sendletter/util/TestUploadStorageHelper.java b/src/integrationTest/java/uk/gov/hmcts/reform/sendletter/util/TestUploadStorageHelper.java index 050639a47..891edc176 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/sendletter/util/TestUploadStorageHelper.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/sendletter/util/TestUploadStorageHelper.java @@ -3,9 +3,8 @@ import com.azure.storage.blob.BlobContainerClient; import com.azure.storage.blob.BlobServiceClient; import com.azure.storage.blob.BlobServiceClientBuilder; -import org.testcontainers.containers.DockerComposeContainer; - -import java.io.File; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.utility.DockerImageName; /* * The Microsoft Azure storage emulator provides a local environment @@ -23,7 +22,9 @@ public class TestUploadStorageHelper { private static TestUploadStorageHelper INSTANCE; public static final String CONTAINER_NAME = "encrypted"; - private static DockerComposeContainer dockerComposeContainer; + private static GenericContainer dockerComposeContainer = + new GenericContainer<>(DockerImageName.parse("mcr.microsoft.com/azure-storage/azurite:3.29.0")) + .withExposedPorts(10000); private static String dockerHost; public static final String STORAGE_CONN_STRING = "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;" + "AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;" @@ -43,17 +44,19 @@ public static TestUploadStorageHelper getInstance() { } private static void createDocker() { - dockerComposeContainer = new DockerComposeContainer<>( - new File("src/integrationTest/resources/docker/docker-compose.yml") - ).withExposedService("azure-storage", 10000) - .withLocalCompose(true); + dockerComposeContainer.withEnv("executable", "blob"); + dockerComposeContainer.withNetworkAliases("azurite"); dockerComposeContainer.start(); - dockerHost = dockerComposeContainer.getServiceHost("azure-storage", 10000); + dockerHost = dockerComposeContainer.getHost(); } private static void initializeStorage() { blobServiceClient = new BlobServiceClientBuilder() - .connectionString(String.format(STORAGE_CONN_STRING, dockerHost, 10000)) + .connectionString(String.format( + STORAGE_CONN_STRING, + dockerHost, + dockerComposeContainer.getMappedPort(10000) + )) .buildClient(); }