Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating cloud build trigger #155

Open
wants to merge 52 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
82fa58d
First attempt at cloud build file
ryangrundy7 Mar 22, 2022
93e11e5
Update first step
ryangrundy7 Mar 22, 2022
ab0ac54
change step to maven
ryangrundy7 Mar 22, 2022
4133de4
Update step to include maven verify
ryangrundy7 Mar 22, 2022
a81c1ee
Change name on third step
ryangrundy7 Mar 22, 2022
575e0ac
test
ryangrundy7 Mar 22, 2022
3ac2e69
Testing docker
ryangrundy7 Mar 22, 2022
b95532e
Attempting to use my own docker for now
ryangrundy7 Mar 22, 2022
2c91cca
Attempting docker compose
ryangrundy7 Mar 22, 2022
f44fbd5
Create network
ryangrundy7 Mar 22, 2022
34bc6e8
close args
ryangrundy7 Mar 22, 2022
0ce1b37
Attempting to get tests running
ryangrundy7 Mar 22, 2022
15b338f
run inside cloudbuild network
ryangrundy7 Mar 22, 2022
e2bbd13
test network
ryangrundy7 Mar 22, 2022
85495d6
external network
ryangrundy7 Mar 22, 2022
e8064ff
please work
ryangrundy7 Mar 22, 2022
2c55396
add cloudbuild network to container
ryangrundy7 Mar 22, 2022
e640d98
removed network from container
ryangrundy7 Mar 22, 2022
6cb6af8
more networking stuff
ryangrundy7 Mar 22, 2022
775995f
another try
ryangrundy7 Mar 23, 2022
8d7b7b2
update docker compose version
ryangrundy7 Mar 23, 2022
70ad052
external network
ryangrundy7 Mar 23, 2022
002bbf5
attempt at networking
ryangrundy7 Mar 23, 2022
e07c12e
remove localhost mention
ryangrundy7 Mar 23, 2022
458a347
changing host
ryangrundy7 Mar 23, 2022
b8ffbd5
revert host change
ryangrundy7 Mar 23, 2022
82c25e7
revert to old network
ryangrundy7 Mar 24, 2022
750b908
cloud build network
ryangrundy7 Mar 24, 2022
b184b98
try changing port in application test
ryangrundy7 Mar 24, 2022
c035236
change postgres port
ryangrundy7 Mar 24, 2022
6c901b4
add another test profile
ryangrundy7 Mar 24, 2022
d67f47d
Merge branch 'main' into creating-cloud-build-trigger
ryangrundy7 Apr 27, 2022
a9cbb64
Added codecov checks
ryangrundy7 Apr 27, 2022
a674629
Trigger cloud build
ryangrundy7 Apr 27, 2022
b740b49
Trigger cloud build again
ryangrundy7 Apr 27, 2022
617d6d4
Install gpg in codecov script
ryangrundy7 Apr 27, 2022
fccde85
attempt to get codecov working in cloud build
ryangrundy7 Apr 27, 2022
5de9dc2
pass in branch to codecov
ryangrundy7 Apr 27, 2022
4e1c991
Fix step
ryangrundy7 Apr 27, 2022
b5574cb
attempting to get codecov working
ryangrundy7 Apr 27, 2022
7225185
trying again
ryangrundy7 Apr 27, 2022
ce8b1e0
Attempting to pass in sha
ryangrundy7 Apr 27, 2022
e759ad2
try inline command
ryangrundy7 Apr 27, 2022
601e7fb
for my boy cloud build
ryangrundy7 Apr 27, 2022
16f109a
pass in PR number
ryangrundy7 Apr 27, 2022
4b43168
Add token to codecov
ryangrundy7 Apr 28, 2022
9da4f48
Trigger cloud build
ryangrundy7 Apr 28, 2022
4c9daca
Use project number
ryangrundy7 Apr 28, 2022
c7dd5cb
Update step image and show no transfer progress
ryangrundy7 May 3, 2022
91c0b70
No progress on formatt check
ryangrundy7 May 3, 2022
362829c
Attempting build with batch mode enabled
ryangrundy7 May 3, 2022
e5138f9
Cloud build run with batch and no transfer progress
ryangrundy7 May 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add another test profile
ryangrundy7 committed Mar 24, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 6c901b40cd54d7177e373ea32cefb7ac1eb96d4b
19 changes: 4 additions & 15 deletions cloudbuild.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
steps:
- name: maven
entrypoint: mvn
args: [ '--version' ]
- name: maven
entrypoint: mvn
args: [ 'fmt:check','pmd:check' ]
id: mvn-format
- id: docker-network
name: 'docker'
args: [ 'network', 'create' ,'ssdcrmdockerdev_default']
waitFor: [ '-' ]
- id: docker-compose
name: 'docker/compose:1.19.0'
args: ['-f', '/workspace/src/test/resources/docker-compose.yml', 'up', '-d']
waitFor: ['docker-network']
- name: maven
name: 'docker/compose:1.29.0'
args: ['-f', '/workspace/src/test/resources/docker-compose-ci.yml', 'up', '-d']
- name: maven:3.8.3-openjdk-17-slim
entrypoint: mvn
args: [ 'verify','jacoco:report', '-DdockerCompose.skip=true' ]
waitFor: ['docker-compose', 'mvn-format']
# - name: bash
# args: ["./check_codecov.sh"]
args: [ 'verify','jacoco:report', '-DdockerCompose.skip=true', '-Dspring.profiles.active=test-ci' ]
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;

@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
public class HealthCheckIT {
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
import uk.gov.ons.ssdc.common.model.entity.UacQidLink;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
public class DeactivateUacReceiverIT {
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@
import uk.gov.ons.ssdc.common.model.entity.UacQidLink;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
class EmailFulfilmentReceiverIT {
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@
import uk.gov.ons.ssdc.common.model.entity.UacQidLink;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
public class EqLaunchReceiverIT {
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
import uk.gov.ons.ssdc.common.model.entity.EventType;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
public class InvalidCaseReceiverIT {
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@
import uk.gov.ons.ssdc.common.model.entity.EventType;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
public class NewCaseReceiverIT {
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@
import uk.gov.ons.ssdc.common.model.entity.FulfilmentToProcess;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
class PrintFulfilmentReceiverIT {
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@
import uk.gov.ons.ssdc.common.model.entity.UacQidLink;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
public class ReceiptReceiverIT {
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
import uk.gov.ons.ssdc.common.model.entity.EventType;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
public class RefusalReceiverIT {
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@
import uk.gov.ons.ssdc.common.model.entity.UacQidLink;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
class SmsFulfilmentReceiverIT {
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@
import uk.gov.ons.ssdc.common.model.entity.UacQidLink;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
class TelephoneCaptureReceiverIT {
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
import uk.gov.ons.ssdc.common.model.entity.UacQidLink;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
public class UacAuthenticationReceiverIT {
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@
import uk.gov.ons.ssdc.common.validation.Rule;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
public class UpdateSampleReceiverIT {
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@
import uk.gov.ons.ssdc.common.validation.Rule;

@ContextConfiguration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@SpringBootTest
@ExtendWith(SpringExtension.class)
public class UpdateSampleSensitiveReceiverIT {
Original file line number Diff line number Diff line change
@@ -7,6 +7,6 @@
import uk.gov.ons.ssdc.common.model.entity.ActionRuleSurveyExportFileTemplate;

@Component
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
public interface ActionRuleSurveyExportFileTemplateRepository
extends JpaRepository<ActionRuleSurveyExportFileTemplate, UUID> {}
Original file line number Diff line number Diff line change
@@ -6,5 +6,5 @@
import uk.gov.ons.ssdc.common.model.entity.EmailTemplate;

@Component
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
public interface EmailTemplateRepository extends JpaRepository<EmailTemplate, String> {}
Original file line number Diff line number Diff line change
@@ -7,6 +7,6 @@
import uk.gov.ons.ssdc.common.model.entity.FulfilmentSurveyExportFileTemplate;

@Component
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
public interface FulfilmentSurveyExportFileTemplateRepository
extends JpaRepository<FulfilmentSurveyExportFileTemplate, UUID> {}
Original file line number Diff line number Diff line change
@@ -6,5 +6,5 @@
import uk.gov.ons.ssdc.common.model.entity.SmsTemplate;

@Component
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
public interface SmsTemplateRepository extends JpaRepository<SmsTemplate, String> {}
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@
import uk.gov.ons.ssdc.common.model.entity.Survey;

@Component
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
public interface SurveyRepository extends JpaRepository<Survey, UUID> {}
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@

@ContextConfiguration
@SpringBootTest
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@ExtendWith(SpringExtension.class)
class ActionRuleIT {
private static final String PACK_CODE = "test-pack-code";
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@

@ContextConfiguration
@SpringBootTest
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@ExtendWith(SpringExtension.class)
class FulfilmentIT {
private static final String FULFILMENT_TOPIC = "event_print-fulfilment";
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
import uk.gov.ons.ssdc.caseprocessor.model.repository.UacQidLinkRepository;

@Component
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
public class DeleteDataHelper {
@Autowired private CaseRepository caseRepository;
@Autowired private CollectionExerciseRepository collectionExerciseRepository;
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
import uk.gov.ons.ssdc.common.model.entity.Event;

@Component
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
public class EventPoller {
private final EventRepository eventRepository;

Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
import uk.gov.ons.ssdc.common.validation.Rule;

@Component
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
public class JunkDataHelper {
private static final Random RANDOM = new Random();

Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
import uk.gov.ons.ssdc.caseprocessor.utils.ObjectMapperFactory;

@Component
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
@EnableRetry
public class PubsubHelper {
@Qualifier("pubSubTemplateForIntegrationTests")
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
import uk.gov.ons.ssdc.caseprocessor.utils.ObjectMapperFactory;

@Configuration
@ActiveProfiles("test")
@ActiveProfiles("${spring.profiles.active}")
public class TestConfig {
@Bean("pubSubTemplateForIntegrationTests")
public PubSubTemplate pubSubTemplate(
22 changes: 22 additions & 0 deletions src/test/resources/application-test-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
spring:
datasource:
url: jdbc:postgresql://postgres-case-it:5432/postgres

cloud:
gcp:
pubsub:
emulator-host: pubsub-emulator-case-it:8538
project-id: our-project

uacservice:
connection:
port: 8164
host: uac-qid-case-it
uacqid-cache-min: 5
uacqid-fetch-count: 10
uacqid-get-timeout: 1 #seconds

caserefgeneratorkey: rPr3qsjlU42hsDX5npfuCzlyF4UYfDTO

queueconfig:
shared-pubsub-project: shared-project
8 changes: 4 additions & 4 deletions src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
spring:
datasource:
url: jdbc:postgresql://postgres-case-it:5432/postgres
url: jdbc:postgresql://localhost:16432/postgres

cloud:
gcp:
pubsub:
emulator-host: pubsub-emulator-case-it:8538
emulator-host: localhost:18538
project-id: our-project

uacservice:
connection:
port: 8164
host: uac-qid-case-it
port: 18164

uacqid-cache-min: 5
uacqid-fetch-count: 10
uacqid-get-timeout: 1 #seconds
55 changes: 55 additions & 0 deletions src/test/resources/docker-compose-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: '3.7'
services:
postgres-case-it:
container_name: postgres-case-it
image: europe-west2-docker.pkg.dev/ssdc-rm-ci/docker/ssdc-rm-dev-common-postgres:latest
command: ["-c", "shared_buffers=256MB", "-c", "max_connections=500"]
ports:
- "16432:5432"
network_mode: cloudbuild

uac-qid-case-it:
container_name: uac-qid-case-it
image: europe-west2-docker.pkg.dev/ssdc-rm-ci/docker/ssdc-rm-uac-qid-service:latest
ports:
- "18164:8164"
external_links:
- postgres-case-it
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres-case-it:5432/postgres?sslmode=disable
- SPRING_PROFILES_ACTIVE=dev
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8164/actuator/health"]
interval: 30s
timeout: 10s
retries: 10
network_mode: cloudbuild

pubsub-emulator-case-it:
container_name: pubsub-emulator-case-it
image: europe-west2-docker.pkg.dev/ssdc-rm-ci/docker/gcloud-pubsub-emulator:latest
ports:
- "18538:8538"
network_mode: cloudbuild

setup-pubsub-emulator-case-it:
container_name: setup-pubsub-emulator-case-it
image: europe-west2-docker.pkg.dev/ssdc-rm-ci/docker/gcloud-pubsub-emulator:latest
environment:
- PUBSUB_SETUP_HOST=pubsub-emulator-case-it:8538
volumes:
- ./setup_pubsub.sh:/setup_pubsub.sh
depends_on:
- pubsub-emulator-case-it
entrypoint: sh -c "/setup_pubsub.sh"

start_dependencies:
image: dadarek/wait-for-dependencies
depends_on:
uac-qid-case-it:
condition: service_healthy

networks:
default:
external:
name: cloudbuild
7 changes: 2 additions & 5 deletions src/test/resources/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
version: '3.7'
version: '2.1'
services:
postgres-case-it:
container_name: postgres-case-it
image: europe-west2-docker.pkg.dev/ssdc-rm-ci/docker/ssdc-rm-dev-common-postgres:latest
command: ["-c", "shared_buffers=256MB", "-c", "max_connections=500"]
ports:
- "16432:5432"
network_mode: cloudbuild

uac-qid-case-it:
container_name: uac-qid-case-it
@@ -23,14 +22,12 @@ services:
interval: 30s
timeout: 10s
retries: 10
network_mode: cloudbuild

pubsub-emulator-case-it:
container_name: pubsub-emulator-case-it
image: europe-west2-docker.pkg.dev/ssdc-rm-ci/docker/gcloud-pubsub-emulator:latest
ports:
- "18538:8538"
network_mode: cloudbuild

setup-pubsub-emulator-case-it:
container_name: setup-pubsub-emulator-case-it
@@ -52,4 +49,4 @@ services:
networks:
default:
external:
name: cloudbuild
name: ssdcrmdockerdev_default