Skip to content

Commit f3ad404

Browse files
Merge branch 'main' into jh/DPC-5177-button-link-fix
2 parents 7683faa + 77f4b81 commit f3ad404

File tree

29 files changed

+296
-144
lines changed

29 files changed

+296
-144
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Create DPC Portal Invite
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
env:
7+
description: AWS environment to check
8+
required: true
9+
type: 'string'
10+
default: 'test'
11+
org_npi:
12+
description: Organization NPI
13+
required: true
14+
type: 'string'
15+
given_name:
16+
description: Given name
17+
required: true
18+
type: 'string'
19+
family_name:
20+
description: Family name
21+
required: true
22+
type: 'string'
23+
email:
24+
description: Email address
25+
required: true
26+
type: 'string'
27+
28+
permissions:
29+
id-token: write
30+
contents: read
31+
32+
jobs:
33+
create-portal-invite:
34+
name: Create DPC Portal Invite
35+
runs-on: codebuild-dpc-app-${{github.run_id}}-${{github.run_attempt}}
36+
steps:
37+
- name: Assert Ownership
38+
run: sudo chmod -R 777 .
39+
- name: Checkout code
40+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
41+
with:
42+
path: dpc-app
43+
- name: AWS Credentials (non-prod)
44+
if: ${{ inputs.env == 'dev' || inputs.env == 'test' }}
45+
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
46+
with:
47+
aws-region: ${{ vars.AWS_REGION }}
48+
role-to-assume: arn:aws:iam::${{ secrets.NON_PROD_ACCOUNT_ID }}:role/delegatedadmin/developer/dpc-${{ inputs.env }}-github-actions
49+
- name: AWS Credentials (prod)
50+
if: ${{ inputs.env == 'sandbox' || inputs.env == 'prod' }}
51+
uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df # v4.2.1
52+
with:
53+
aws-region: ${{ vars.AWS_REGION }}
54+
role-to-assume: arn:aws:iam::${{ secrets.PROD_ACCOUNT_ID }}:role/delegatedadmin/developer/dpc-${{ inputs.env }}-github-actions
55+
- name: Install AWS Session Manager Plugin
56+
run: |
57+
sudo dnf install -y https://s3.amazonaws.com/session-manager-downloads/plugin/latest/linux_64bit/session-manager-plugin.rpm
58+
- name: Set cluster and service names
59+
run: |
60+
echo "CLUSTER_NAME=dpc-${{ inputs.env }}-frontend" >> $GITHUB_ENV
61+
echo "SERVICE_NAME=dpc-${{ inputs.env }}-web-portal-v9" >> $GITHUB_ENV
62+
- name: Start temp service
63+
run: ./dpc-app/scripts/start_temp_service.sh $CLUSTER_NAME $SERVICE_NAME
64+
- name: Generate invite link
65+
env:
66+
RAILS_CMD: rails dpc:invite_ao INVITE=${{ inputs.given_name }},${{ inputs.family_name }},${{ inputs.email }},${{ inputs.org_npi }}
67+
run: |
68+
aws ecs execute-command \
69+
--region ${{ vars.AWS_REGION }} \
70+
--cluster $CLUSTER_NAME \
71+
--task $NEW_TASK_ID \
72+
--container $NEW_CONTAINER_NAME \
73+
--command "$RAILS_CMD " \
74+
--interactive
75+
- name: Delete temp service
76+
if: always()
77+
run: |
78+
aws ecs delete-service \
79+
--force \
80+
--cluster $CLUSTER_NAME \
81+
--service $NEW_SERVICE_NAME
82+
- name: Deregister the task definition
83+
if: always()
84+
run: |
85+
TASK_DEF_ARN=$(aws ecs describe-tasks --cluster "$CLUSTER_NAME" --tasks "$NEW_TASK_ARN" | jq -r '.tasks[].taskDefinitionArn')
86+
aws ecs deregister-task-definition --task-definition $TASK_DEF_ARN

.github/workflows/smoke-test.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ jobs:
6363
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
6464
with:
6565
go-version: '1.24.x'
66+
- name: Install PACE cert
67+
env:
68+
PACE_CERT: ${{ secrets.PACE_CERT }}
69+
run: |
70+
echo "${PACE_CERT}" > /etc/pki/ca-trust/source/anchors/pace.pem
71+
update-ca-trust
6672
- name: Build K6
6773
run: |
6874
# Install xk6

dpc-api/src/main/java/gov/cms/dpc/api/entities/IpAddressEntity.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import jakarta.persistence.Entity;
1111
import jakarta.persistence.GeneratedValue;
1212
import jakarta.persistence.Id;
13-
import jakarta.validation.constraints.NotNull;
1413
import org.hibernate.annotations.CreationTimestamp;
1514

1615
import java.io.Serializable;
@@ -33,9 +32,6 @@ public class IpAddressEntity implements Serializable {
3332
@JsonDeserialize(using = InetDeserializer.class)
3433
private Inet ipAddress;
3534

36-
@NotNull
37-
private String label;
38-
3935
@Column(name = "created_at", columnDefinition = "timestamp with time zone")
4036
@JsonSerialize(converter = OffsetDateTimeToStringConverter.class)
4137
@JsonDeserialize(converter = StringToOffsetDateTimeConverter.class)
@@ -48,7 +44,5 @@ public class IpAddressEntity implements Serializable {
4844
public UUID getOrganizationId() {return organizationId;}
4945
public IpAddressEntity setIpAddress(Inet ipAddress) {this.ipAddress = ipAddress; return this;}
5046
public Inet getIpAddress() {return ipAddress;}
51-
public IpAddressEntity setLabel(String label) {this.label = label; return this;}
52-
public String getLabel() {return label;}
5347
public OffsetDateTime getCreatedAt() {return createdAt;}
5448
}

dpc-api/src/main/java/gov/cms/dpc/api/models/CreateIpAddressRequest.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,17 @@
44
import jakarta.validation.constraints.NotEmpty;
55

66
public class CreateIpAddressRequest {
7-
private String label;
87

98
@NotEmpty
109
private String ipAddress;
1110

12-
public String getLabel() {return this.label;}
13-
public CreateIpAddressRequest setLabel(String label) {this.label = label; return this;}
14-
1511
@JsonProperty("ip_address")
1612
public String getIpAddress() {return this.ipAddress;}
1713
@JsonProperty("ip_address")
1814
public CreateIpAddressRequest setIpAddress(String ipAddress) {this.ipAddress = ipAddress; return this;}
1915

20-
public CreateIpAddressRequest(@JsonProperty("ip_address") String ipAddress, @JsonProperty("label") String label) {
21-
this.setIpAddress(ipAddress);
22-
this.setLabel(label);
23-
}
24-
public CreateIpAddressRequest(String ipAddress) {
16+
public CreateIpAddressRequest(@JsonProperty("ip_address") String ipAddress) {
2517
this.setIpAddress(ipAddress);
26-
this.setLabel(null);
2718
}
19+
2820
}

dpc-api/src/main/java/gov/cms/dpc/api/resources/v1/IpAddressResource.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ public IpAddressEntity submitIpAddress(@ApiParam(hidden = true) @Auth Organizati
8484
} else {
8585
IpAddressEntity ipAddressEntity = new IpAddressEntity()
8686
.setOrganizationId(organizationPrincipal.getID())
87-
.setIpAddress(ipAddress)
88-
.setLabel(createIpAddressRequest.getLabel());
87+
.setIpAddress(ipAddress);
8988

9089
return this.dao.persistIpAddress(ipAddressEntity);
9190
}

dpc-api/src/main/resources/migrations/auth.migrations.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,13 @@
150150
</sql>
151151
</changeSet>
152152

153+
<changeSet id="drop-ip-addresses-label-column" author="Jose Alejandro">
154+
<preConditions onFail="MARK_RAN">
155+
<columnExists tableName="IP_ADDRESSES" columnName="label"/>
156+
</preConditions>
157+
158+
<dropColumn tableName="IP_ADDRESSES" columnName="label"/>
159+
</changeSet>
160+
161+
153162
</databaseChangeLog>

dpc-api/src/test/java/gov/cms/dpc/api/entities/IpAddressEntityTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package gov.cms.dpc.api.entities;
22

3-
import gov.cms.dpc.api.entities.IpAddressEntity;
43
import io.hypersistence.utils.hibernate.type.basic.Inet;
54
import org.junit.jupiter.api.Test;
65

@@ -16,16 +15,13 @@ void testGettersAndSetters() {
1615
UUID id = UUID.randomUUID();
1716
UUID orgId = UUID.randomUUID();
1817
String ip = "192.0.0.1";
19-
String label = "label string";
2018

2119
ipAddress.setId(id);
2220
ipAddress.setOrganizationId(orgId);
2321
ipAddress.setIpAddress(new Inet(ip));
24-
ipAddress.setLabel(label);
2522

2623
assertEquals(id, ipAddress.getId());
2724
assertEquals(orgId, ipAddress.getOrganizationId());
2825
assertEquals(ip, ipAddress.getIpAddress().getAddress());
29-
assertEquals(label, ipAddress.getLabel());
3026
}
3127
}

dpc-api/src/test/java/gov/cms/dpc/api/jdbi/IpAddressDAOUnitTest.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,18 @@ public void setUp() {
2424
@Test
2525
void writesIpAddress() {
2626
UUID orgId = UUID.randomUUID();
27-
IpAddressEntity ipAddressEntity = createIpAddressEntity(orgId, "192.168.1.1", "test label");
27+
IpAddressEntity ipAddressEntity = createIpAddressEntity(orgId, "192.168.1.1");
2828
IpAddressEntity returnedIp = db.inTransaction(() -> ipAddressDAO.persistIpAddress(ipAddressEntity));
2929

3030
assertEquals(orgId, returnedIp.getOrganizationId());
3131
assertEquals("192.168.1.1", returnedIp.getIpAddress().getAddress());
32-
assertEquals("test label", returnedIp.getLabel());
3332
assertFalse(returnedIp.getCreatedAt().toString().isEmpty());
3433
assertFalse(returnedIp.getId().toString().isEmpty());
3534
}
3635

3736
@Test
3837
void failsWritingBadIpAddress() {
39-
IpAddressEntity ipAddressEntity = createIpAddressEntity(UUID.randomUUID(), "bad_ip", "test label");
38+
IpAddressEntity ipAddressEntity = createIpAddressEntity(UUID.randomUUID(), "bad_ip");
4039
assertThrows(PersistenceException.class, () ->
4140
db.inTransaction(() -> ipAddressDAO.persistIpAddress(ipAddressEntity)));
4241
}
@@ -47,9 +46,9 @@ void fetchesIpAddress() {
4746
UUID orgId2 = UUID.randomUUID();
4847

4948
db.inTransaction(() -> {
50-
ipAddressDAO.persistIpAddress(createIpAddressEntity(orgId1, "192.168.1.1", "label 1"));
51-
ipAddressDAO.persistIpAddress(createIpAddressEntity(orgId1, "192.168.1.2", "label 2"));
52-
ipAddressDAO.persistIpAddress(createIpAddressEntity(orgId2, "192.168.1.3", "label 3"));
49+
ipAddressDAO.persistIpAddress(createIpAddressEntity(orgId1, "192.168.1.1"));
50+
ipAddressDAO.persistIpAddress(createIpAddressEntity(orgId1, "192.168.1.2"));
51+
ipAddressDAO.persistIpAddress(createIpAddressEntity(orgId2, "192.168.1.3"));
5352
});
5453

5554
List<IpAddressEntity> results = db.inTransaction(() -> ipAddressDAO.fetchIpAddresses(orgId1));
@@ -59,20 +58,18 @@ void fetchesIpAddress() {
5958
IpAddressEntity ip1 = results.get(0);
6059
assertEquals(orgId1, ip1.getOrganizationId());
6160
assertEquals("192.168.1.1", ip1.getIpAddress().getAddress());
62-
assertEquals("label 1", ip1.getLabel());
6361

6462
IpAddressEntity ip2 = results.get(1);
6563
assertEquals(orgId1, ip2.getOrganizationId());
6664
assertEquals("192.168.1.2", ip2.getIpAddress().getAddress());
67-
assertEquals("label 2", ip2.getLabel());
6865
}
6966

7067
@Test
7168
void deletesIpAddress() {
7269
UUID orgId = UUID.randomUUID();
7370

7471
IpAddressEntity persistedIpAddress = db.inTransaction(() ->
75-
ipAddressDAO.persistIpAddress(createIpAddressEntity(orgId, "192.168.1.1", "label 1")));
72+
ipAddressDAO.persistIpAddress(createIpAddressEntity(orgId, "192.168.1.1")));
7673

7774
List<IpAddressEntity> results = db.inTransaction(() -> {
7875
ipAddressDAO.deleteIpAddress(persistedIpAddress);
@@ -82,10 +79,9 @@ void deletesIpAddress() {
8279
assertEquals(0, results.size());
8380
}
8481

85-
private IpAddressEntity createIpAddressEntity(UUID orgId, String address, String label) {
82+
private IpAddressEntity createIpAddressEntity(UUID orgId, String address) {
8683
return new IpAddressEntity()
8784
.setOrganizationId(orgId)
88-
.setIpAddress(new Inet(address))
89-
.setLabel(label);
85+
.setIpAddress(new Inet(address));
9086
}
9187
}

dpc-api/src/test/java/gov/cms/dpc/api/models/CreateIpAddressRequestUnitTest.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,15 @@
88
class CreateIpAddressRequestUnitTest {
99
@Test
1010
public void testConstructor() {
11-
CreateIpAddressRequest createIpAddressRequest = new CreateIpAddressRequest("192.168.1.1", "label");
12-
assertEquals("192.168.1.1", createIpAddressRequest.getIpAddress());
13-
assertEquals("label", createIpAddressRequest.getLabel());
14-
}
15-
16-
@Test
17-
public void testAltConstructor() {
1811
CreateIpAddressRequest createIpAddressRequest = new CreateIpAddressRequest("192.168.1.1");
1912
assertEquals("192.168.1.1", createIpAddressRequest.getIpAddress());
20-
assertNull(createIpAddressRequest.getLabel());
2113
}
2214

2315
@Test
2416
public void testSettersAndSetters() {
2517
CreateIpAddressRequest createIpAddressRequest = new CreateIpAddressRequest("192.168.1.1");
2618

2719
createIpAddressRequest.setIpAddress("10.1.1.1");
28-
createIpAddressRequest.setLabel("new label");
2920
assertEquals("10.1.1.1", createIpAddressRequest.getIpAddress());
30-
assertEquals("new label", createIpAddressRequest.getLabel());
3121
}
32-
}
22+
}

dpc-api/src/test/java/gov/cms/dpc/api/resources/v1/IpAddressResourceTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class IpAddressResourceTest extends AbstractSecureApplicationTest {
3838

3939
private static IpAddressEntity ipAddressEntityResponse = new IpAddressEntity();
4040

41-
private final CreateIpAddressRequest ipRequest = new CreateIpAddressRequest("192.168.1.1", "test label");
41+
private final CreateIpAddressRequest ipRequest = new CreateIpAddressRequest("192.168.1.1");
4242

4343
private IpAddressResourceTest() throws IOException, URISyntaxException {
4444
this.fullyAuthedToken = APIAuthHelpers.jwtAuthFlow(getBaseURL(), ORGANIZATION_TOKEN, PUBLIC_KEY_ID, PRIVATE_KEY).accessToken;
@@ -90,7 +90,6 @@ public void testPost_happyPath() throws IOException, URISyntaxException {
9090
IpAddressEntity responseIp = mapper.readValue(response.getEntity().getContent(), IpAddressEntity.class);
9191
assertNotNull(responseIp.getId());
9292
assertEquals(ORGANIZATION_ID, responseIp.getOrganizationId().toString());
93-
assertEquals(ipRequest.getLabel(), responseIp.getLabel());
9493
assertEquals(ipRequest.getIpAddress(), responseIp.getIpAddress().getAddress());
9594
assertNotNull(responseIp.getCreatedAt());
9695

@@ -119,7 +118,6 @@ public void testGet() throws URISyntaxException, IOException {
119118
IpAddressEntity responseIp = responseCollection.getEntities().stream().findFirst().get();
120119
assertNotNull(responseIp.getId());
121120
assertEquals(ipAddressEntityResponse.getOrganizationId(), responseIp.getOrganizationId());
122-
assertEquals(ipAddressEntityResponse.getLabel(), responseIp.getLabel());
123121
assertEquals(ipAddressEntityResponse.getIpAddress(), responseIp.getIpAddress());
124122
assertNotNull(responseIp.getCreatedAt());
125123
}
@@ -158,10 +156,10 @@ public void testDelete_notFound() throws URISyntaxException, IOException {
158156
public void testPost_tooManyIps() throws IOException, URISyntaxException {
159157
// We shouldn't have any rows in the table at this point, so fill up to the max
160158
for(int i=1; i<=8; i++) {
161-
writeIpAddress(String.format("test post %d", i), "192.168.1.1");
159+
writeIpAddress("192.168.1.1");
162160
}
163161

164-
CreateIpAddressRequest ipAddressRequest = new CreateIpAddressRequest("192.128.1.1","should not post");
162+
CreateIpAddressRequest ipAddressRequest = new CreateIpAddressRequest("192.128.1.1");
165163

166164
CloseableHttpClient client = HttpClients.createDefault();
167165
String ipAddressJson = mapper.writeValueAsString(ipAddressRequest);
@@ -196,8 +194,8 @@ public void testPost_noIp() throws IOException, URISyntaxException {
196194
assertEquals(HttpStatus.SC_BAD_REQUEST, response.getCode());
197195
}
198196

199-
private IpAddressEntity writeIpAddress(String label, String ip) throws URISyntaxException, IOException {
200-
CreateIpAddressRequest ipAddressRequest = new CreateIpAddressRequest(ip, label);
197+
private IpAddressEntity writeIpAddress(String ip) throws URISyntaxException, IOException {
198+
CreateIpAddressRequest ipAddressRequest = new CreateIpAddressRequest(ip);
201199

202200
try (final CloseableHttpClient client = HttpClients.createDefault()) {
203201
String ipAddressJson = mapper.writeValueAsString(ipAddressRequest);

0 commit comments

Comments
 (0)