Skip to content

Commit

Permalink
move buckets.json out of workflow dir [skip-audit] (#2515)
Browse files Browse the repository at this point in the history
* move buckets.json out of workflow dir [skip-audit]

Does just moving the file out of workflows work?

* Updates CHANGELOG.md

* Use commons/stack helper getBucketsConfigKey

Remove hard coding of buckets.json path.
  • Loading branch information
flamingbear authored Oct 14, 2021
1 parent 8a4128e commit 59797db
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@ upgrades to `knex` package.
`update_granules_cmr_metadata_file_links_task_timeout` property

### Changed

- Updated `knex` version from 0.23.11 to 0.95.11 to address security vulnerabilities
- Updated default version of async operations Docker image to `cumuluss/async-operation:35`
- **CUMULUS-2590**
- Granule applyWorkflow, Reingest actions and Bulk operation now update granule status to `queued` when scheduling the granule.

- **CUMULUS-2643**
- relocates system file `buckets.json` out of the
`s3://internal-bucket/workflows` directory into
`s3://internal-bucket/buckets`.


## [v9.7.0] 2021-10-01

### Notable Changes
Expand Down
3 changes: 2 additions & 1 deletion packages/api/tests/endpoints/test-granules.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const indexer = require('@cumulus/es-client/indexer');
const { Search } = require('@cumulus/es-client/search');
const launchpad = require('@cumulus/launchpad-auth');
const { randomString, randomId } = require('@cumulus/common/test-utils');
const { getBucketsConfigKey } = require('@cumulus/common/stack');
const { getDistributionBucketMapKey } = require('@cumulus/distribution-utils');
const { constructCollectionId } = require('@cumulus/message/Collections');

Expand Down Expand Up @@ -135,7 +136,7 @@ async function setupBucketsConfig() {
process.env.DISTRIBUTION_ENDPOINT = 'http://example.com/';
await s3PutObject({
Bucket: systemBucket,
Key: `${process.env.stackName}/workflows/buckets.json`,
Key: getBucketsConfigKey(process.env.stackName),
Body: JSON.stringify(buckets),
});
await createBucket(buckets.public.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const {
} = require('@cumulus/aws-client/S3');
const awsServices = require('@cumulus/aws-client/services');
const BucketsConfig = require('@cumulus/common/BucketsConfig');
const { getBucketsConfigKey } = require('@cumulus/common/stack');
const { constructCollectionId } = require('@cumulus/message/Collections');
const { randomString, randomId } = require('@cumulus/common/test-utils');
const { getDistributionBucketMapKey } = require('@cumulus/distribution-utils');
Expand Down Expand Up @@ -79,7 +80,7 @@ async function storeBucketsConfigToS3(buckets, systemBucket, stackName) {

return await awsServices.s3().putObject({
Bucket: systemBucket,
Key: `${stackName}/workflows/buckets.json`,
Key: getBucketsConfigKey(stackName),
Body: JSON.stringify(bucketsConfig),
}).promise();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/stack.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const getBucketsConfigKey = (stackName: string) =>
`${stackName}/workflows/buckets.json`;
`${stackName}/buckets/buckets.json`;
3 changes: 2 additions & 1 deletion packages/integration-tests/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const dotenv = require('dotenv');
const get = require('lodash/get');
const yaml = require('js-yaml');
const { getBucketsConfigKey } = require('@cumulus/common/stack');
const { getJsonS3Object } = require('@cumulus/aws-client/S3');
const isNil = require('lodash/isNil');
const { readFile, readFileSync } = require('fs-extra');
Expand Down Expand Up @@ -66,7 +67,7 @@ const loadConfig = async () => {

const buckets = await getJsonS3Object(
configFromFile.bucket,
`${configFromFile.stackName}/workflows/buckets.json`
getBucketsConfigKey(configFromFile.stackName)
);

return { ...configFromFile, buckets };
Expand Down
2 changes: 1 addition & 1 deletion tf-modules/cumulus/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ locals {

resource "aws_s3_bucket_object" "buckets_json" {
bucket = var.system_bucket
key = "${var.prefix}/workflows/buckets.json"
key = "${var.prefix}/buckets/buckets.json"
content = jsonencode(var.buckets)
etag = md5(jsonencode(var.buckets))
}

0 comments on commit 59797db

Please sign in to comment.