Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into B-16972
Browse files Browse the repository at this point in the history
  • Loading branch information
j-Rosenthal committed Sep 1, 2023
2 parents e0bf985 + 4333efa commit 150e675
Show file tree
Hide file tree
Showing 309 changed files with 10,213 additions and 2,016 deletions.
File renamed without changes.
12 changes: 9 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,9 @@ jobs:
- run:
name: Install Frozen YARN dependencies
command: yarn install --frozen-lockfile --cache-folder ~/.cache/yarn
- run: make client_test_coverage
- run:
name: client test coverage
command: JEST_JUNIT_OUTPUT_DIR=jest-junit-reports make client_test_coverage
- run:
# https://support.circleci.com/hc/en-us/articles/10816400480411-How-to-pass-environment-variables-between-jobs
name: Copy Workflow Job ID to file
Expand All @@ -1515,7 +1517,7 @@ jobs:
path: ~/transcom/mymove/coverage
destination: coverage
- store_test_results:
path: ~/transcom/mymove
path: ~/transcom/mymove/jest-junit-reports
- persist_to_workspace:
root: .
paths:
Expand Down Expand Up @@ -1688,7 +1690,11 @@ jobs:
- restore_cache:
keys:
- v2-node-modules-cache-{{ checksum "yarn.lock" }}
- run: make client_build
- run:
name: make client_build
command: |
export REACT_APP_ERROR_LOGGING=otel
make client_build
# only save the cache on default branch builds so that PRs don't pollute
# the cache
- when:
Expand Down
13 changes: 8 additions & 5 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,13 @@ export GOTENBERG_PORT=2000
# interactions
export DTOD_USE_MOCK=true

# Client build flags
#
# Send error logs to the console for local development. Set to 'otel'
# to send to the backend
export REACT_APP_ERROR_LOGGING=console


# Anti-Virus Settings
export AV_DIR="${MYMOVE_DIR}"
# WARNING: IGNORE FILES AT OUR PERIL. IF ADDING HERE ADD NOTES!
Expand All @@ -304,11 +311,7 @@ if [ ! -r .nix-disable ] && has nix-env; then
# set NIX_PROFILE so nix-env operations don't need to manually
# specify the profile path
#
if [ -w "/nix/var/nix/profiles/per-user/${LOGNAME}" ]; then
export NIX_PROFILE="/nix/var/nix/profiles/per-user/${LOGNAME}/mymove"
else
log_error "Cannot determine writable location for your NIX_PROFILE"
fi
export NIX_PROFILE="/nix/var/nix/profiles/per-user/${LOGNAME}/mymove"

# Having NIX_SSL_CERT_FILE set means go won't use macOS keychain based certs
export NIX_SSL_CERT_FILE_ORIG=$NIX_SSL_CERT_FILE
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/analyze-bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out branch
uses: actions/checkout@v3.5.3
uses: actions/checkout@v3.6.0

- name: Set up node
uses: actions/setup-node@v3
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out base branch
uses: actions/checkout@v3.5.3
uses: actions/checkout@v3.6.0
with:
ref: ${{ github.base_ref }}

Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
pull-requests: write
steps:
- uses: actions/download-artifact@v3
- uses: github/[email protected].1
- uses: github/[email protected].2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
current-stats-json-path: ./head-stats/bundle-stats.json
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/front-end-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3.5.3
uses: actions/checkout@v3.6.0

- name: Set up node
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/go-auto-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3.5.3
uses: actions/checkout@v3.6.0
with:
fetch-depth: 0
if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/happo-tests-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3.5.3
uses: actions/checkout@v3.6.0

- name: Set up node
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/happo-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3.5.3
uses: actions/checkout@v3.6.0

- name: Set up node
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18.2
FROM alpine:3.18.3

# hadolint ignore=DL3017
RUN apk upgrade --no-cache busybox
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.migrations
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18.2
FROM alpine:3.18.3

# hadolint ignore=DL3017
RUN apk upgrade --no-cache busybox
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.migrations_local
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN rm -f bin/milmove && make bin/milmove
# FINAL #
#########

FROM alpine:3.18.2
FROM alpine:3.18.3

# hadolint ignore=DL3017
RUN apk upgrade --no-cache busybox
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.reviewapp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RUN set -x \
&& make bin/generate-test-data

# define migrations before client build since it doesn't need client
FROM alpine:3.18.2 as migrate
FROM alpine:3.18.3 as migrate

COPY --from=server_builder /build/bin/rds-ca-2019-root.pem /bin/rds-ca-2019-root.pem
COPY --from=server_builder /build/bin/milmove /bin/milmove
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.tools
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.18.2
FROM alpine:3.18.3

# hadolint ignore=DL3017
RUN apk upgrade --no-cache busybox
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.tools_local
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN rm -f bin/prime-api-client && make bin/prime-api-client
# FINAL #
#########

FROM alpine:3.18.2
FROM alpine:3.18.3

# hadolint ignore=DL3017
RUN apk upgrade --no-cache busybox
Expand Down
44 changes: 41 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ client_deps: .check_hosts.stamp .client_deps.stamp ## Install client dependencie
touch .client_deps.stamp

.client_build.stamp: .client_deps.stamp $(shell find src -type f)
REACT_APP_GIT_COMMIT=$(GIT_COMMIT) \
REACT_APP_GIT_BRANCH=$(GIT_BRANCH) \
yarn build
touch .client_build.stamp

Expand All @@ -184,7 +186,10 @@ build/downloads: public/downloads

.PHONY: client_run
client_run: .client_deps.stamp ## Run MilMove Service Member client
HOST=milmovelocal yarn start
REACT_APP_GIT_COMMIT=$(GIT_COMMIT) \
REACT_APP_GIT_BRANCH=$(GIT_BRANCH) \
HOST=milmovelocal \
yarn start

.PHONY: client_test
client_test: .client_deps.stamp ## Run client unit tests
Expand All @@ -196,11 +201,17 @@ client_test_coverage : .client_deps.stamp ## Run client unit test coverage

.PHONY: office_client_run
office_client_run: .client_deps.stamp ## Run MilMove Office client
HOST=officelocal yarn start
REACT_APP_GIT_COMMIT=$(GIT_COMMIT) \
REACT_APP_GIT_BRANCH=$(GIT_BRANCH) \
HOST=officelocal \
yarn start

.PHONY: admin_client_run
admin_client_run: .client_deps.stamp ## Run MilMove Admin client
HOST=adminlocal yarn start
REACT_APP_GIT_COMMIT=$(GIT_COMMIT) \
REACT_APP_GIT_BRANCH=$(GIT_BRANCH) \
HOST=adminlocal \
yarn start

#
# ----- END CLIENT TARGETS -----
Expand Down Expand Up @@ -781,6 +792,7 @@ tasks_connect_to_gex_via_sftp: tasks_build_linux_docker ## Run connect-to-gex-vi
-e GEX_SFTP_HOST_KEY \
-e GEX_SFTP_IP_ADDRESS \
-e GEX_SFTP_PASSWORD \
-e GEX_PRIVATE_KEY \
-e GEX_SFTP_PORT \
-e GEX_SFTP_USER_ID \
--link="$(DB_DOCKER_CONTAINER_DEV):database" \
Expand Down Expand Up @@ -1057,6 +1069,28 @@ pretty: gofmt ## Run code through JS and Golang formatters
docker_circleci: ## Run CircleCI container locally with project mounted
docker run -it --pull=always --rm=true -v $(PWD):$(PWD) -w $(PWD) -e CIRCLECI=1 milmove/circleci-docker:milmove-app-726bfe44bd27d3b41da41acbe3eb231811a993f7 bash

.PHONY: docker_local_ssh_server_with_password
docker_local_ssh_server_with_password:
docker run --rm \
--name sshd \
-e USER_NAME=testu \
-e USER_PASSWORD=testp \
-e PASSWORD_ACCESS=true \
-p 2222:2222 \
-v some_local_upload_dir:/config/uploads \
linuxserver/openssh-server


.PHONY: docker_local_ssh_server_with_key
docker_local_ssh_server_with_key:
docker run --rm \
--name sshd \
-e PUBLIC_KEY="${TEST_GEX_PUBLIC_KEY}" \
-e USER_NAME=testu \
-p 2222:2222 \
-v some_local_upload_dir:/config/uploads \
linuxserver/openssh-server

.PHONY: prune_images
prune_images: ## Prune docker images
@echo '****************'
Expand Down Expand Up @@ -1128,6 +1162,10 @@ reviewapp_docker_destroy:
.PHONY: telemetry_docker
telemetry_docker:
docker-compose -f docker-compose.telemetry.yml up

.PHONY: feature_flag_docker
feature_flag_docker:
docker-compose -f docker-compose.feature_flag.yml up
#
# ----- END RANDOM TARGETS -----
#
Expand Down
63 changes: 63 additions & 0 deletions cmd/load-spreadsheet-data/load-updated-loa-trnsn-ids.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import os, sys, pandas as pd
from datetime import datetime

if len(sys.argv) < 2:
sys.exit("Input file required.")


# Generate to gitignored tmp directory to prevent committing secure data
current_dir = os.getcwd()
destination_directory = 'tmp/generated-secure-migrations'
filename = f"{datetime.now().strftime('%Y%m%d%H%M%S')}_update_loa_trnsn_ids.up.sql"
secure_migration_filename = (
f'{current_dir}/{destination_directory}/{filename}'
)

destination_path = f'{current_dir}/{destination_directory}'
if not os.path.exists(destination_path):
os.makedirs(destination_path)

with open(secure_migration_filename, "w+") as f:
f.write('-- Update loa_trnsn_id column constraint\n')
f.write('ALTER TABLE lines_of_accounting ALTER COLUMN loa_trnsn_id TYPE varchar (3);\n')

# Skip the first and last rows which are just "unclassified"
input_file = pd.read_excel(sys.argv[1], skiprows=1, skipfooter=1)

# Missing values should be NULL
input_file = input_file.fillna('NULL')

f.write('-- Update lines_of_accounting with updated loa_trnsn_id values, mapped by loa_sys_id\n')
f.write('UPDATE lines_of_accounting AS loas SET\n')
f.write('\tloa_trnsn_id = updated.loa_trnsn_id\n')
f.write('FROM (VALUES\n')

has_written_at_least_one_value_to_file = False
for index, row in input_file.iterrows():
loa_sys_id = row['LOA_SYS_ID']
loa_hs_gds_cd = row['LOA_HS_GDS_CD']
loa_trnsn_id = row['LOA_TRNSN_ID']

# Ignore rows where loa_sys_id is missing
if loa_sys_id == 'NULL':
continue

# Ignore rows where the loa_hs_gds_cd does not have a value, as we did during the original import
if loa_hs_gds_cd == 'NULL':
continue

# Add single quotes around non-null values, otherwise, just use NULL
loa_trnsn_id_write_value = loa_trnsn_id if loa_trnsn_id == 'NULL' else f"'{loa_trnsn_id}'"

if has_written_at_least_one_value_to_file:
# prepend next line with a comma and a newline
f.write(',\n')

f.write(f'\t({loa_sys_id}, {loa_trnsn_id_write_value})')

# Now that at least one entry has been added to the file, we know to prepend the rest with `,\n`
has_written_at_least_one_value_to_file = True

f.write('\n) AS updated(loa_sys_id, loa_trnsn_id)\n')
f.write('WHERE updated.loa_sys_id = loas.loa_sys_id;\n')
sys.exit()
Loading

0 comments on commit 150e675

Please sign in to comment.