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

[Prod] DevOps: Fail Fast, update python, cimg Namespace, & Backup production DB on each deploy #2174

Merged
merged 57 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e473765
wip
AdamAdHocTeam May 16, 2024
16299c7
check for all ipd urls
AdamAdHocTeam May 16, 2024
12d6cc6
update test data
AdamAdHocTeam May 16, 2024
2ee1ca1
handler test
AdamAdHocTeam May 17, 2024
b16f535
remove resources from course counts
AdamAdHocTeam May 17, 2024
f93804e
roll up
AdamAdHocTeam May 17, 2024
3e09751
wip have to fix tests
AdamAdHocTeam May 17, 2024
6a0607b
fix BE tests and cleanup
AdamAdHocTeam May 17, 2024
7bb1cd2
added FE test and rename file
AdamAdHocTeam May 20, 2024
a7cb87f
add course db page
AdamAdHocTeam May 20, 2024
551118f
add tests for internal redirect and use same key for filter
AdamAdHocTeam May 20, 2024
562cdaa
add checkboxes and css updates WIP
AdamAdHocTeam May 21, 2024
ef1558c
add tests for checkboxes
AdamAdHocTeam May 21, 2024
8f92bde
checkbox logic with tests
AdamAdHocTeam May 21, 2024
b2dec7b
add export to csv with tests
AdamAdHocTeam May 22, 2024
09d8f81
Merge branch 'main' into al-ttahub-2868-ipd-course-widget
AdamAdHocTeam May 22, 2024
a5799c1
fix be tests
AdamAdHocTeam May 22, 2024
b6db508
test coverage
AdamAdHocTeam May 22, 2024
1e84aef
more coverage
AdamAdHocTeam May 22, 2024
341b20c
coverage
AdamAdHocTeam May 23, 2024
456f7c4
exclude persisted courses from csv import
AdamAdHocTeam May 23, 2024
dc4e671
fixes and remove unused redirect
AdamAdHocTeam May 23, 2024
16d1cbd
Merge branch 'main' into al-ttahub-2868-ipd-course-widget
AdamAdHocTeam May 23, 2024
f5b9232
coverage
AdamAdHocTeam May 23, 2024
b3fdc64
lint
AdamAdHocTeam May 23, 2024
871eb87
roll back BE changes to see if it fixes test
AdamAdHocTeam May 23, 2024
3629770
put some stuff back
AdamAdHocTeam May 23, 2024
8ecb052
put more stuff back
AdamAdHocTeam May 23, 2024
971313a
put back the other test
AdamAdHocTeam May 23, 2024
1c34d5d
fix
AdamAdHocTeam May 23, 2024
93718e5
fixes and upates per Matt
AdamAdHocTeam May 24, 2024
241af25
Merge branch 'main' into al-ttahub-2868-ipd-course-widget
AdamAdHocTeam May 24, 2024
617ca63
Merge branch 'main' into al-ttahub-2868-ipd-course-widget
AdamAdHocTeam May 24, 2024
54995f7
fixes and UX changes
AdamAdHocTeam May 24, 2024
c3e5dad
Fix icon placement
AdamAdHocTeam May 24, 2024
6752c1a
fix url name and update sorting
AdamAdHocTeam May 28, 2024
c43c999
Update config.yml
GarrettEHill May 29, 2024
03f38f8
15.6 is the version used in cloud.gov
GarrettEHill May 29, 2024
542c16f
Update config.yml
GarrettEHill May 29, 2024
d4ea47a
verify build packs
GarrettEHill May 29, 2024
ae8727b
more readable versions on error
GarrettEHill May 29, 2024
623fde4
Update config.yml
GarrettEHill May 29, 2024
416db0e
update python
GarrettEHill May 29, 2024
e8be3ca
Update config.yml
GarrettEHill May 29, 2024
ce348ea
Update config.yml
GarrettEHill May 29, 2024
86a5946
Update config.yml
GarrettEHill May 29, 2024
d7fa574
Update config.yml
GarrettEHill May 29, 2024
0c6a3b4
Merge pull request #2170 from HHS/TTAHUB-3023/update-python
GarrettEHill May 29, 2024
e93395e
Merge branch 'main' into TTAHUB-1852/fail-fast
GarrettEHill May 29, 2024
71b44dc
Merge pull request #2168 from HHS/TTAHUB-2556-cimg
GarrettEHill May 29, 2024
82c7cb7
ux design fixes
AdamAdHocTeam May 29, 2024
7e70917
Merge pull request #2169 from HHS/TTAHUB-1852/fail-fast
GarrettEHill May 29, 2024
05f78c1
css clean up per Matt
AdamAdHocTeam May 29, 2024
0251d71
update test
AdamAdHocTeam May 29, 2024
d953cfc
Merge pull request #2171 from HHS/TTAHUB-3022/backup-on-deploy
GarrettEHill May 29, 2024
165d139
fixes per Matt
AdamAdHocTeam May 29, 2024
12bbe99
Merge pull request #2150 from HHS/al-ttahub-2868-ipd-course-widget
AdamAdHocTeam May 30, 2024
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
56 changes: 40 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ executors:
- image: cimg/node:18.20.3-browsers
environment:
DATABASE_URL: postgresql://postgres@localhost/ttasmarthub
- image: circleci/postgres:12.4-ram
- image: cimg/postgres:15.6
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secretpass
POSTGRES_DB: ttasmarthub
docker-python-executor:
docker:
- image: cimg/python:3.9.18
- image: cimg/python:3.9.19
docker-postgres-elasticsearch-executor:
docker:
- image: cimg/node:18.20.3-browsers
environment:
DATABASE_URL: postgresql://postgres@localhost/ttasmarthub
- image: circleci/postgres:12.4-ram
- image: cimg/postgres:15.6
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secretpass
Expand Down Expand Up @@ -462,9 +462,25 @@ jobs:
- run:
name: Lint backend
command: yarn lint:ci
- run:
name: Audit vulnerability of backend node_modules
command: |
chmod 744 ./run-yarn-audit.sh
./run-yarn-audit.sh;
- run:
name: Lint frontend
command: yarn --cwd frontend lint:ci
- run:
name: Audit vulnerability of frontend node_modules
command: |
cd frontend
chmod 744 ./run-yarn-audit.sh
./run-yarn-audit.sh;
- run:
name: Check nodejs version compatibility with buildpack
command: |
chmod +x ./bin/check_node_version_compatibility.sh
./bin/check_node_version_compatibility.sh
- store_artifacts: # store backend lint reports
path: reports
- store_artifacts: # store frontend lint reports
Expand Down Expand Up @@ -497,6 +513,11 @@ jobs:
source venv/bin/activate
pip install -U pip setuptools wheel
pip install -U -r requirements.txt
- run:
name: Check python version compatibility with buildpack
command: |
chmod +x ./bin/check_python_version_compatibility.sh
./bin/check_python_version_compatibility.sh
- save_cache:
paths:
- similarity_api/src/venv
Expand All @@ -522,11 +543,6 @@ jobs:
at: .
- setup_remote_docker:
version: default
- run:
name: Audit vulnerability of backend node_modules
command: |
chmod 744 ./run-yarn-audit.sh
./run-yarn-audit.sh;
- run:
name: Run migrations ci
command: yarn db:migrate:ci
Expand Down Expand Up @@ -563,7 +579,7 @@ jobs:
- run:
name: Syft SBOM
environment:
SYFT_VERSION: v0.82.0
SYFT_VERSION: v1.5.0
IMAGE_NAME: ghcr.io/kcirtapfromspace/cloudfoundry_circleci:latest
OUTPUT_FORMAT: json
OUTPUT_FILE: reports/syft_sbom.json
Expand All @@ -577,7 +593,7 @@ jobs:
- run:
name: Grype Docker image
environment:
GRYPE_VERSION: v0.62.2
GRYPE_VERSION: v0.78.0
OUTPUT_FORMAT: sarif
OUTPUT_FILE: reports/grype.json
command: |
Expand Down Expand Up @@ -607,12 +623,6 @@ jobs:
command: |
chmod 744 ./checkcolorhash.sh
./checkcolorhash.sh;
- run:
name: Audit vulnerability of frontend node_modules
command: |
cd frontend
chmod 744 ./run-yarn-audit.sh
./run-yarn-audit.sh;
- run:
name: Test frontend
command: yarn --cwd frontend run test:ci --maxWorkers=50%
Expand Down Expand Up @@ -1069,6 +1079,20 @@ workflows:
- dynamic_security_scan:
requires:
- build_and_lint
- backup_upload_production:
requires:
- test_backend
- test_frontend
- test_e2e
- test_api
- test_similarity_api
- test_utils
- cucumber_test
- dynamic_security_scan
filters:
branches:
only:
- << pipeline.parameters.prod_git_branch >>
- deploy:
requires:
- test_backend
Expand Down
35 changes: 35 additions & 0 deletions bin/check_node_version_compatibility.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# check_node_version_compatibility.sh
# Script to fetch the required Node.js version and compare with buildpack

# Read Node.js version from .nvmrc file at the root of the project and remove carriage returns and new lines
node_version_required=$(cat .nvmrc | tr -d '\r' | tr -d '\n')

# Fetch the latest release data from GitHub
latest_release_info=$(curl -s https://api.github.com/repos/cloudfoundry/nodejs-buildpack/releases/latest)

# Parse the release data to extract supported Node.js versions using jq, grep, awk, and sort
supported_versions=$(echo "$latest_release_info" | jq -r '.body' | grep 'node' | awk '{print $4}' | grep -vP '[^.0-9]' | sort -u)

# Check if the required version is supported by iterating over the array
version_found=0
for version in $supported_versions; do
echo "Checking if $version == $node_version_required"
if [[ "$version" == "$node_version_required" ]]; then
version_found=1
break
fi
done

echo ""

if [[ $version_found -eq 1 ]]; then
echo "Required Node.js version $node_version_required is supported."
exit 0 # Exit with success
else
echo "Required Node.js version $node_version_required is not supported."
echo "Supported Versions:"
echo "$supported_versions"
exit 1 # Exit with error
fi
35 changes: 35 additions & 0 deletions bin/check_python_version_compatibility.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# check_python_version_compatibility.sh
# Script to fetch the required Python version and compare with buildpack

# Read Python version from .python-version file
python_version_required=$(cat similarity_api/.python-version | tr -d '\r' | tr -d '\n')

# Fetch the latest release data from GitHub
latest_release_info=$(curl -s https://api.github.com/repos/cloudfoundry/python-buildpack/releases/latest)

# Parse the release data to extract supported Python versions using jq, grep, awk, and sort
supported_versions=$(echo "$latest_release_info" | jq -r '.body' | grep python | awk '{print $4}' | grep -vP '[^.0-9]' | sort -u)

# Check if the required version is supported by iterating over the array
version_found=0
for version in $supported_versions; do
echo "Checking if $version == $python_version_required"
if [[ "$version" == "$python_version_required" ]]; then
version_found=1
break
fi
done

echo ""

if [[ $version_found -eq 1 ]]; then
echo "Required Python version $python_version_required is supported."
exit 0 # Exit with success
else
echo "Required Python version $python_version_required is not supported."
echo "Supported Versions:"
echo "$supported_versions"
exit 1 # Exit with error
fi
10 changes: 10 additions & 0 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import Admin from './pages/Admin';
import RegionalDashboard from './pages/RegionalDashboard';
import TrainingReports from './pages/TrainingReports';
import ResourcesDashboard from './pages/ResourcesDashboard';
import CourseDashboard from './pages/CourseDashboard';
import Unauthenticated from './pages/Unauthenticated';
import NotFound from './pages/NotFound';
import Home from './pages/Home';
Expand Down Expand Up @@ -261,6 +262,15 @@ function App() {
</AppWrapper>
)}
/>
<Route
exact
path="/dashboards/ipd-courses"
render={() => (
<AppWrapper authenticated logout={logout}>
<CourseDashboard />
</AppWrapper>
)}
/>
<Route
exact
path="/training-reports/:status(not-started|in-progress|complete|suspended)"
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -411,3 +411,9 @@ fill: #1B1B1B;
writing-mode: vertical-lr;
transform: rotate(180deg);
}

.text-overflow-ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
2 changes: 2 additions & 0 deletions frontend/src/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export const GOVERNMENT_HOSTNAME_EXTENSION = '.ohs.acf.hhs.gov';
export const ESCAPE_KEY_CODE = 27;
export const GOALS_PER_PAGE = 10;
export const TOPICS_PER_PAGE = 10;
export const COURSES_PER_PAGE = 10;

// In Internet Explorer (tested on release 9 and 11) and Firefox 36 and earlier
// the Esc key returns "Esc" instead of "Escape".
Expand All @@ -174,3 +175,4 @@ export const LOCAL_STORAGE_DATA_KEY = (id) => `ar-form-data-${id}-${LOCAL_STORAG
export const LOCAL_STORAGE_ADDITIONAL_DATA_KEY = (id) => `ar-additional-data-${id}-${LOCAL_STORAGE_CACHE_NUMBER}`;
export const LOCAL_STORAGE_EDITABLE_KEY = (id) => `ar-can-edit-${id}-${LOCAL_STORAGE_CACHE_NUMBER}`;
export const SESSION_STORAGE_IMPERSONATION_KEY = `auth-impersonation-id-${LOCAL_STORAGE_CACHE_NUMBER}`;
export const REGIONAL_RESOURCE_DASHBOARD_FILTER_KEY = 'regional-resources-dashboard-filters';
4 changes: 2 additions & 2 deletions frontend/src/components/PaginationCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ function PaginationCard({

return (
<div className={`smart-hub--pagination-card display-flex bg-white ${className}`}>
<div className="display-flex flex-1 flex-align-center margin-left-4">{getPageInfo()}</div>
<div className="display-flex flex-1 flex-align-center">{getPageInfo()}</div>
<Pagination
className="padding-1"
className="margin-0"
currentPage={currentPage}
totalPages={getTotalPages()}
onClickNext={() => handlePageChange(currentPage + 1)}
Expand Down
44 changes: 29 additions & 15 deletions frontend/src/components/WidgetContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export default function WidgetContainer(
showHeaderBorder,
titleSlot,
className,
enableCheckboxes,
exportRows,
footNote,
},
) {
return (
Expand All @@ -44,6 +47,8 @@ export default function WidgetContainer(
className="flex-justify-self-end"
/>
) : null}
enableCheckboxes={enableCheckboxes}
exportRows={exportRows}
>
{titleSlot}
</WidgetContainerTitleGroup>
Expand All @@ -57,21 +62,24 @@ export default function WidgetContainer(
<div className="margin-top-0">
{children}
</div>
<div className="smart-hub-widget-container-footer">
{
showPagingBottom
? (
<PaginationCard
currentPage={currentPage}
totalCount={totalCount}
offset={offset}
perPage={perPage}
handlePageChange={handlePageChange}
/>
)
: null
}
</div>
{showPagingBottom || footNote ? (
<div className="smart-hub-widget-container-footer padding-3">
{footNote && (
<p className="usa-prose font-sans-3xs margin-top-0">
{footNote}
</p>
)}
{showPagingBottom && (
<PaginationCard
currentPage={currentPage}
totalCount={totalCount}
offset={offset}
perPage={perPage}
handlePageChange={handlePageChange}
/>
)}
</div>
) : null}
</Container>
);
}
Expand All @@ -93,6 +101,9 @@ WidgetContainer.propTypes = {
showHeaderBorder: PropTypes.bool,
titleSlot: PropTypes.node,
className: PropTypes.string,
enableCheckboxes: PropTypes.bool,
exportRows: PropTypes.func,
footNote: PropTypes.string,
};

WidgetContainer.defaultProps = {
Expand All @@ -111,4 +122,7 @@ WidgetContainer.defaultProps = {
titleSlot: null,
loadingLabel: 'Loading',
className: '',
enableCheckboxes: false,
exportRows: () => {},
footNote: null,
};
4 changes: 4 additions & 0 deletions frontend/src/components/WidgetContainer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@

.smart-hub-widget-container .smart-hub-widget-container-footer {
border-top: 1px solid $base-lighter;
}

.smart-hub-widget-container .smart-hub--menu-button .fa-ellipsis {
font-size: 1.5rem;
}
Loading