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

Testing codecov report with cloudbuild #157

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 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
91950b9
Removing travis to test cloudbuild only
ryangrundy7 May 4, 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
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

38 changes: 38 additions & 0 deletions cloudbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
steps:
- name: maven:3.8.3-openjdk-17-slim
entrypoint: mvn
args: [ 'fmt:check','pmd:check', '--no-transfer-progress', '-B' ]
id: mvn-format
- id: docker-compose
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', '-Dspring.profiles.active=test-ci', '--no-transfer-progress', '-B' ]
- name: gcr.io/cloud-builders/curl
entrypoint: bash
secretEnv: [ CODECOV_TOKEN_CP ]
args:
- '-eEuo'
- 'pipefail'
- '-c'
- |-
apt-get update
apt-get install -y gnupg
apt-get install -y git
gpg --no-default-keyring --keyring trustedkeys.gpg --import codecov_public_key.asc
curl -Os https://uploader.codecov.io/latest/linux/codecov
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig

# NOTE: the "|| exit 1"'s are required to stop travis continuing to run subsequent steps even if the integrity checks failed
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM || exit 1
shasum -a 256 -c codecov.SHA256SUM || exit 1

chmod +x codecov
./codecov -t $$CODECOV_TOKEN_CP -C $COMMIT_SHA -B $BRANCH_NAME -r "ONSdigital/ssdc-rm-caseprocessor" -P $_PR_NUMBER

availableSecrets:
secretManager:
- versionName: projects/$PROJECT_NUMBER/secrets/codecov-token-case-processor/versions/1
env: CODECOV_TOKEN_CP
19 changes: 19 additions & 0 deletions codecov_checks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ls
echo $_HEAD_BRANCH
echo $_PR_NUMBER
apt-get update
apt-get install -y gnupg
apt-get install -y git
gpg --no-default-keyring --keyring trustedkeys.gpg --import codecov_public_key.asc
curl -Os https://uploader.codecov.io/latest/linux/codecov
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig

# NOTE: the "|| exit 1"'s are required to stop travis continuing to run subsequent steps even if the integrity checks failed
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM || exit 1
shasum -a 256 -c codecov.SHA256SUM || exit 1

chmod +x codecov
COMMIT_SHA_LONG = $COMMIT_SHA
echo $COMMIT_SHA_LONG
./codecov -C $COMMIT_SHA_LONG -r "ONSdigital/ssdc-rm-caseprocessor
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
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
Loading