320 Commits

Author SHA1 Message Date
dandds
387f957aa4 Add CircleCI config for staging deployment.
This generalizes the deploy step into a configurable CircleCI command.
The available parameters are:

- `namespace`: the K8s namespace to alter
- `tag`: the docker tag to apply to the image

The script for applying migrations to the K8s environment and the
corresponding K8s Job config have been generalized so that they can be
configured to run in the specified namespace.

The main workflow has been updated so that the appropriate deployment
will happen, depending on whether we are merging to staging or master.
In the future, we could look to add an additional workflow based around
Git tags for production.

Note that this also removes the creation of the `latest` tag from CD.
That tag is no longer hard-coded into our K8s config and so there's no
longer a need to update it in our container registry.
2019-11-13 09:56:36 -05:00
dandds
23c4ba32eb CI/CD uses Docker containers exclusively and removes CircleCI Orbs.
The CircleCI Orbs were useful for getting started, but now that we only
have to deploy to one provider our pipeline should be tailored to
efficiently push to just that environment. This inlines all the relevant
pieces from the Orbs we were relying on as bash/sh commands instead.

This builds the Docker images upfront. Since we have a multi-stage
Dockerfile, it builds the first stage as a separate image and then
proceeds to build the complete image. This is done so that the first
stage (called "builder") can be used for testing. It retains executables
like pipenv that we need to install development dependencies needed for
tests.

Other notes:
- CircleCI does not persist Docker images between jobs. As a
  work-around, we use the CircleCI caching mechanism to create a named
  cache with *.tar copies of the images. Subsequent jobs use the cache
  and load the images.
- Both the test and integration-tests jobs need to make minor
  modifications to the container to run correctly. The test job needs to
  install the development Python dependencies, and the integration-tests
  job needs to rebuild the JS bundle so that it uses the mock uploader
  (the container is build to use the Azure uploader by default).
- The test and integration-tests jobs run in parallel.
- This adjusts the Dockerfile so that the TZ environment variable is set
  for both stages of the build.
2019-10-30 12:04:21 -04:00
dandds
380a9beb6f
Merge pull request #1140 from dod-ccpo/azure-ci
Update CI and remove AWS config.
2019-10-28 11:34:25 -04:00
dandds
d514305f26 Remove unused scripts. 2019-10-26 16:15:32 -04:00
richard-dds
c66b1ef2f9 Add mypy and add typechecking step to script/test
Only check atst/domain/csp/cloud.py for now
2019-10-24 14:44:53 -04:00
leigh-mil
6619c77df5
Merge pull request #1123 from dod-ccpo/add-test-templates-gitignore
Ignore js/test_templates
2019-10-18 12:06:30 -04:00
dandds
4169dcb310 Fix CI/CD bug with PGSSLROOTCERT.
Because I pushed the environment variable changes to the cluster
already, psycopg2 was automatically trying to connect to the database
using the file specified in PGSSLROOTCERT. That ConfigMap was not
mounted into the migrations container, so I'm doing that here.
2019-10-17 14:59:41 -04:00
leigh-mil
248e93103b Add js/test_templates to .gitignore file and remove ignored folder 2019-10-16 13:53:40 -04:00
dandds
d1ed0f6692 Add setup script and configuration for Minikube cluster.
The Minikube version of the cluster has some differences from the main
config (noted in the README) but will be useful for for future DevOps
development.
2019-10-04 17:48:46 -04:00
dandds
ae57baf455
Merge pull request #1094 from dod-ccpo/test-changes
updates to script/test and JS coverage
2019-09-26 15:44:14 -04:00
dandds
6c22d5a524 Apply section heads to test output for clarity.
This also removes a test setup command that added an uploads directory.
It's no longer necessary.
2019-09-26 13:23:17 -04:00
leigh-mil
7ad7c79897 Update seed script so app members have invites 2019-09-26 09:46:24 -04:00
dandds
8d7c7a0d6e Render Vue component templates as part of test script.
Add a command to the test script to output up-to-date Vue component
templates. Most of the Vue component tests rely on HTML templates built
from Jinja.
2019-09-25 11:32:10 -04:00
dandds
3a23c54723 Add a beat processing schedule for environment provisioning jobs.
The beat schedule is set to once per minute for each of the three
environment provisioning tasks.

Adding a beat schedule surfaced two problems that are addressed here
with the following changes:
- Commit the SQLALchemy session in order to release the environment
  lock. Otherwise the change to the `claimed_until` field is not
  persisted.
- Set `none_as_null` on the JSOB fields on the `Environment`. This
  avoids problems with querying on Postgres JSON fields that are empty.

This also adds a small change to the development command for the Celery
worker. Multiple child processes were executing the beat jobs, which
lead to exceptions for environment locks and confusing log output. This
contrains the dev command to a single Celery worker.
2019-09-18 16:34:56 -04:00
dandds
b107f84c75 Do not try to copy crl-tmp contents if empty.
The Kubernetes CronJob for syncing CRLs syncs them to a temporary folder
and then copies them to the real location once the sync is complete. If
the temporary folder is empty, the `cp` command throws an error. This
updates the bash script that manages the sync so that it will skip the
copy command if the temporary location is empty.
2019-09-16 11:23:15 -04:00
richard-dds
f6cb6f2a31 Change Environment.creator relation from ApplicationRole to User 2019-09-11 11:42:59 -04:00
richard-dds
ac0c194490 Add celery beat worker 2019-09-11 11:41:57 -04:00
dandds
dfb4536b5d Do not add User.permission_sets to sample portfolio users 2019-09-04 13:02:53 -04:00
dandds
d7478e322a Use Celery instead of RQ.
Celery provides a more robust set of queueing options for both tasks and
worker processes. Updates include:
- infrastructure necessary to run Celery, including celery entrypoint
- backgrounded functions are now imported directly from atst.jobs
- update tests as-needed
- update kubernetes worker pod command
2019-08-29 09:33:47 -04:00
dandds
4d7af9a4d0 Fix portfolio user names in seed_sample.py script.
`script/seed_sample.py` was creating portfolio users with no names
because it was calling `Users.get_or_create_by_dod_id` with a DOD ID as
its only argument. This updates it to pass the rest of the profile
information for the sample user.
2019-08-14 14:43:35 -04:00
richard-dds
36d39dc949 Use unique attachment object names 2019-08-14 10:39:58 -04:00
richard-dds
ac7de6b4d2 Formatting 2019-08-13 13:49:49 -04:00
richard-dds
034645d013 Fix seed script 2019-08-13 10:51:44 -04:00
dandds
529a7b71c9
Merge pull request #1016 from dod-ccpo/detect-secrets
Scripts for finding accidental secrets in the repo.
2019-08-13 10:16:13 -04:00
dandds
2a0168b1e6 Scripts for finding accidental secrets in the repo.
This adds the following:
- A detect-secrets dependency and a related script
  (`script/detect_secrets`) to find and alert developers to secrets
  added to the code. By default, the script will search staged and new,
  unstaged files. It can optionally search only staged files.
- A whitelist, `.secrets.baseline`, that tracks instances of secrets or
  false positives already in the repo.
- Modifies `script/test` to detect secrets as part of the test suite.
- Updates to the README regarding the use of detect-secrets.
2019-08-13 05:59:56 -04:00
dandds
d5706454e3 Fix newline issues in script/write_dotenv.
In `sh` on Alpine Linux in our Docker images, the newline characters in
the script were being interpreted as literals. This substitutes a
HEREDOC instead.
2019-08-09 14:55:18 -04:00
dandds
485f578c78 Apply config changes for CSP file uploads.
This applies configuration changes for the Flask app and adds changes to
the Dockerfile so that the build can make a CSP-specific JS bundle. It
adds `write_dotenv` script that creates the appropriate `.env` file for
the `parcel` bundler depending on how the `CSP` environment variable is
set.

- Configure K8s environment variables for Flask CSP usage
- Supply default CSP config setting to Flask app
- Declare the CSP arg in the Dockerfile
- Supply extra Docker build args to CD
- Fix top-level reference to boto3 in file_upload module
- Add back missing sample NGINX config for docker-compose build
2019-08-09 08:05:20 -04:00
dandds
d79127f652 Update the k8s config directory in the migration script. 2019-08-08 12:02:02 -04:00
dandds
44141c002d Fix up sync-crls script and add to Dockerfile.
- Fix some python formatting and import issues
- Fix dockerfile to include sync-crls script
- Adjust sync-crls script to use paths and CLI tools available in the
  Docker container
2019-08-06 11:31:19 -04:00
dandds
b1cf89051a Add kubernetes config and scripts for syncing CRLs.
This adds a previous version of the CRL sync functionality back to the
repo, with some small adjustments. We now grab the CRLs directly from
their DISA URLs.

The CRL sync is handled by a kubernetes cronjob that sync the files to a
persistent volume that is mounted into each Flask app container.
2019-08-06 11:05:18 -04:00
dandds
f3e032fc03 Finalize CD config and add k8s job for migrations.
Add CircleCI config for both CSPs to:
- build the Docker image and push it to the registry
- run a short-lived k8s job to apply migrations and see data
- update the images for the Flask pods and rq worker pods
2019-07-31 11:58:43 -04:00
dandds
beabd2ce72 Remove the scriptz submodule and hard-commit the files.
The submodule is a leftover from when this project was intended to work
as a series of microservices. It was meant to provide common
functionality to the builds for every microservice. That's no longer the
case, and the submodule is a pain-point both in on-boarding new
developers and running the Docker build.
2019-07-14 16:01:13 -04:00
George Drummond
9f274a7d1c
Script to find unused translations 2019-06-14 09:59:07 -04:00
George Drummond
32022b054c
Merge pull request #895 from dod-ccpo/seeds-changes
More realistic seeds
2019-06-12 15:43:34 -04:00
George Drummond
c719999cdb
Attach PDFs to task orders 2019-06-12 15:02:57 -04:00
dandds
bea2e02253 Remove unused EDA client code 2019-06-12 13:42:55 -04:00
George Drummond
9edf816765
More realistic seeds 2019-06-12 11:41:40 -04:00
richard-dds
ee46fb2320 Formatting 2019-06-10 15:34:01 -04:00
richard-dds
40b599d1d0 Fix rebase conflicts 2019-06-10 15:33:30 -04:00
richard-dds
7f4f857424 Sort task orders by status and time_created 2019-06-10 15:16:02 -04:00
richard-dds
e84e61bbad Update seed script with TOs of various statuses 2019-06-10 15:15:39 -04:00
George Drummond
f7562714cb
Add New Portfolio Workflow 2019-06-04 13:10:42 -04:00
dandds
5434443b02 Adjust script/seed_sample.py for new portfolio invitation flow. 2019-06-03 15:57:49 -04:00
leigh-mil
1784318e0e Update seed_sample with new TO info 2019-05-31 13:07:03 -04:00
dandds
df06d1b62f Use application_role_id on environment_roles.
In the future, an `application_invitation1 will not refer to a `user` until
someone accepts the invitation; they'll only reference an
`application_role`. When a user is invited to an application, the
inviter can specify the environments the invitee should have access to.
For this to be possible, an `environment_role` should reference an
`application_role`, because no `user` entity will be known at that time.

In addition to updating all the models and domain methods necessary for
this change, this commit deletes unused code and tests that were
dependent on `environment_roles` having a `user_id` foreign key.
2019-05-31 11:21:20 -04:00
George Drummond
1b217113d4
Keep alembic_version table 2019-05-29 11:40:23 -04:00
George Drummond
0a8868ca37
Just clean out tables for seed sample reset 2019-05-28 13:31:55 -04:00
leigh-mil
9412ccffea Reorder items to delete so that join models are deleted before the models they join
Add application invitations to list of items to be deleted
Clean up reference to workspace
2019-05-22 19:41:30 -04:00
George Drummond
334f3d8ed3
Move js to form component 2019-05-03 14:48:27 -04:00
George Drummond
0996f254cb
Use prettier rather than sass-convert 2019-05-03 14:01:08 -04:00