Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
57 changes: 24 additions & 33 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,33 @@ docker pull ghcr.io/scality/cloudserver:<tag>

To release a production image:

* Create a PR to bump the package version
Update Cloudserver's `package.json` by bumping it to the relevant next
version in a new PR. Per example if the last released version was
`8.4.7`, the next version would be `8.4.8`.

```js
{
"name": "cloudserver",
"version": "8.4.8", <--- Here
[...]
}
```
* Create a PR to bump the package version :
update Cloudserver's `package.json` by bumping it to the relevant next
version in a new PR. Per example if the last released version was `8.4.7`,
the next version would be `8.4.8`.

```js
{
"name": "cloudserver",
"version": "8.4.8", <--- Here
[...]
}
```

* Review & merge the PR

* Create the release on GitHub

* Go the Release tab (https://github.com/scality/cloudserver/releases);
* Click on the `Draft new release button`;
* In the `tag` field, type the name of the release (`8.4.8`), and confirm
to create the tag on publish;
* Click on `Generate release notes` button to fill the fields;
* Rename the release to `Release x.y.z` (e.g. `Release 8.4.8` in this case);
* Click to `Publish the release` to create the GitHub release and git tag

Notes:
* the Git tag will be created automatically.
* this should be done as soon as the PR is merged, so that the tag
is put on the "version bump" commit.

* With the following parameters, [force a build here](https://eve.devsca.com/github/scality/cloudserver/#/builders/3/force/force)

* Branch Name: The one used for the tag earlier. In this example `development/8.4`
* Override Stage: 'release'
* Extra properties:
* name: `'tag'`, value: `[release version]`, in this example`'8.4.8'`
* Trigger the release workflow on GitHub

* Go to the [**Actions** tab on GitHub](https://github.com/scality/cloudserver/actions)
* Select the `release` workflow from the list
* Click on **Run workflow** (manual dispatch)
* Enter the new tag (e.g., `8.4.8`) in the input field
* Start the workflow

This workflow will create the tag and push the Docker images.

This should be done as soon as the PR is merged,
so that the tag is put on the "version bump" commit.

* Release the release version on Jira

Expand Down
12 changes: 12 additions & 0 deletions lib/api/apiUtils/authorization/prepareRequestContexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,18 @@ function prepareRequestContexts(apiMethod, request, sourceBucket,
generateRequestContext('bypassGovernanceRetention');
requestContexts.push(checkUserGovernanceBypassRequestContext);
}
} else if (apiMethodAfterVersionCheck === 'bucketGet') {
requestContexts.push(generateRequestContext(apiMethodAfterVersionCheck));

const optionalAttributesHeader = request.headers['x-amz-optional-object-attributes'];
const requestedAttributes = optionalAttributesHeader ?
optionalAttributesHeader.split(',').map(
header => header !== 'RestoreStatus' ? header.toLowerCase() : header
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, the reason why RestoreStatus is not lower-cased is because of AWS standard ? why not leaving the other params the same ? Because we store them lower-cased ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for what I understand, you added this since user metadata are expected to be lower case in AWS (did not check, but I think I saw you mention this). In that case,

  • what happens (on AWS) if an upper case metadata is used? It is rejected, just "converted" to lower case?
  • how does our API behave? If
  • Does this apply to the prefix (x-amz-meta-) as well? e.g. if we only consider lower case prefix, no need to convert to lower case for filtering user-metadata properties...

(overall, trying to say that we don't need to be too defensive here: if spec & API both only support lower user-metadata, no need to spend cycle trying to accomodate, we can just be strict and expect user to behave correctly)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, user metadata are lowercase. AWS will convert a non lowercase usermetadata to a lowercase (we are doing the same). And yes, this apply to the prefix also.

) : [];

if (requestedAttributes.filter(attr => attr != 'RestoreStatus').length > 0) {
requestContexts.push(generateRequestContext('listObjectsV2OptionalAttributes'));
}
} else {
const requestContext =
generateRequestContext(apiMethodAfterVersionCheck);
Expand Down
26 changes: 18 additions & 8 deletions lib/api/bucketGet.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,15 @@ function bucketGet(authInfo, request, log, callback) {
const params = request.query;
const bucketName = request.bucketName;
const v2 = params['list-type'];

const optionalAttributes =
request.headers['x-amz-optional-object-attributes']?.split(',').map(attr => attr.trim()) ?? [];
if (optionalAttributes.some(attr => !attr.startsWith('x-amz-meta-') && attr != 'RestoreStatus')) {
return callback(
errorInstances.InvalidArgument.customizeDescription('Invalid header x-amz-optional-object-attributes')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the official aws error ? If so we can leave it, but if its a custom one that you choose, why not add the value of the problematic value

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, the error returned by AWS is Invalid attribute name specified so I guess I must do the same 👏

);
}

if (v2 !== undefined && Number.parseInt(v2, 10) !== 2) {
return callback(errorInstances.InvalidArgument.customizeDescription('Invalid ' +
'List Type specified in Request'));
Expand Down Expand Up @@ -352,21 +361,22 @@ function bucketGet(authInfo, request, log, callback) {
}

standardMetadataValidateBucket(metadataValParams, request.actionImplicitDenies, log, (err, bucket) => {
const corsHeaders = collectCorsHeaders(request.headers.origin,
request.method, bucket);
const corsHeaders = collectCorsHeaders(request.headers.origin, request.method, bucket);

if (err) {
log.debug('error processing request', { error: err });
monitoring.promMetrics(
'GET', bucketName, err.code, 'listBucket');
monitoring.promMetrics('GET', bucketName, err.code, 'listBucket');
return callback(err, null, corsHeaders);
}

if (params.versions !== undefined) {
listParams.listingType = 'DelimiterVersions';
delete listParams.marker;
listParams.keyMarker = params['key-marker'];
listParams.versionIdMarker = params['version-id-marker'] ?
versionIdUtils.decode(params['version-id-marker']) : undefined;
}

if (!requestMaxKeys) {
const emptyList = {
CommonPrefixes: [],
Expand All @@ -377,14 +387,14 @@ function bucketGet(authInfo, request, log, callback) {
return handleResult(listParams, requestMaxKeys, encoding, authInfo,
bucketName, emptyList, corsHeaders, log, callback);
}
return services.getObjectListing(bucketName, listParams, log,
(err, list) => {

return services.getObjectListing(bucketName, listParams, log, (err, list) => {
if (err) {
log.debug('error processing request', { error: err });
monitoring.promMetrics(
'GET', bucketName, err.code, 'listBucket');
monitoring.promMetrics('GET', bucketName, err.code, 'listBucket');
return callback(err, null, corsHeaders);
}

return handleResult(listParams, requestMaxKeys, encoding, authInfo,
bucketName, list, corsHeaders, log, callback);
});
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"node-mocks-http": "^1.16.1",
"nodemon": "^3.1.10",
"nyc": "^15.1.0",
"pino-pretty": "^13.1.3",
"sinon": "^13.0.1",
"tv4": "^1.3.0"
},
Expand All @@ -82,7 +83,7 @@
},
"scripts": {
"cloudserver": "S3METADATA=mongodb npm-run-all --parallel start_dataserver start_s3server",
"dev": "nodemon --exec \"yarn run start\"",
"dev": "nodemon --exec \"yarn run start\" | pino-pretty -c -S -m message -i \"pid,hostname,name,authn,authz,address,clientPort,clientIP,elapsed_ms\"",
"ft_awssdk": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/ --exit",
"ft_awssdk_aws": "cd tests/functional/aws-node-sdk && AWS_ON_AIR=true mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/ --exit",
"ft_awssdk_buckets": "cd tests/functional/aws-node-sdk && mocha --reporter mocha-multi-reporters --reporter-options configFile=$INIT_CWD/tests/reporter-config.json test/bucket --exit",
Expand Down
Loading
Loading