Skip to content

Commit

Permalink
Merge branch 'development/7.10' into tmp/octopus/w/7.10/dependabot/np…
Browse files Browse the repository at this point in the history
…m_and_yarn/development/7.4/xml2js-0.6.0
  • Loading branch information
bert-e committed Jul 13, 2023
2 parents 3559f40 + c57a6e3 commit bd540ba
Show file tree
Hide file tree
Showing 7 changed files with 1,118 additions and 39 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: codeQL

on:
push:
branches: [development/*, stabilization/*, hotfix/*]
pull_request:
branches: [development/*, stabilization/*, hotfix/*]
workflow_dispatch:

jobs:
analyze:
name: Static analysis with CodeQL
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: javascript, python, ruby

- name: Build and analyze
uses: github/codeql-action/analyze@v2
16 changes: 16 additions & 0 deletions .github/workflows/dependency-review.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: dependency review

on:
pull_request:
branches: [development/*, stabilization/*, hotfix/*]

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3

- name: 'Dependency Review'
uses: actions/dependency-review-action@v3
12 changes: 3 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,26 +217,20 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: |
2.7
3.9
python-version: 3.9
- name: Setup CI environment
uses: ./.github/actions/setup-ci
- name: Setup python2 test environment
- name: Setup python test environment
run: |
sudo apt-get install -y libdigest-hmac-perl
pip install virtualenv==20.21.0
virtualenv -p $(which python2) ~/.virtualenv/py2
source ~/.virtualenv/py2/bin/activate
pip install 's3cmd==1.6.1'
pip install 's3cmd==2.3.0'
- name: Setup CI services
run: docker-compose up -d
working-directory: .github/docker
- name: Run file ft tests
run: |-
set -o pipefail;
bash wait_for_local_port.bash 8000 40
source ~/.virtualenv/py2/bin/activate
yarn run ft_test | tee /tmp/artifacts/${{ github.job }}/tests.log
- name: Upload logs to artifacts
uses: scality/action-artifacts@v3
Expand Down
60 changes: 51 additions & 9 deletions lib/routes/routeBackbeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,22 +472,64 @@ function putMetadata(request, response, bucketInfo, objMd, log, callback) {
omVal[headerName] = objMd[headerName];
});
}
const versionId = decodeVersionId(request.query);
// specify both 'versioning' and 'versionId' to create a "new"
// version (updating master as well) but with specified
// versionId
const options = {
versioning: bucketInfo.isVersioningEnabled(),
versionId,
};

let versionId = decodeVersionId(request.query);
let versioning = bucketInfo.isVersioningEnabled();
let isNull = false;

if (versionId === 'null') {
isNull = true;
// Retrieve the null version id from the object metadata.
versionId = objMd && objMd.versionId;
if (!versionId) {
if (versioning) {
// If the null version does not have a version id, it is a current null version.
// To update the metadata of a current version, versioning is set to false.

// This condition is to handle the case where a single null version looks like a master
// key and will not have a duplicate versioned key and no version ID.
// They are created when you have a non-versioned bucket with objects,
// and then convert bucket to versioned.
// If no new versioned objects are added for given object(s), they look like
// standalone master keys.
versioning = false;
} else {
const versioningConf = bucketInfo.getVersioningConfiguration();
// The purpose of this condition is to address situations in which
// - versioning is "suspended" and
// - no existing object or no null version.
// In such scenarios, we generate a new null version and designate it as the master version.
if (versioningConf && versioningConf.Status === 'Suspended') {
versionId = '';
omVal.isNull = true;
}
}
}
}

// If the object is from a source bucket without versioning (i.e. NFS),
// then we want to create a version for the replica object even though
// none was provided in the object metadata value.
if (omVal.replicationInfo.isNFS) {
const isReplica = omVal.replicationInfo.status === 'REPLICA';
options.versioning = isReplica;
versioning = isReplica;
omVal.replicationInfo.isNFS = !isReplica;
}

const options = {
versionId,
isNull,
};

// NOTE: When 'versioning' is set to true and no 'versionId' is specified,
// it results in the creation of a "new" version, which also updates the master.
// NOTE: Since option fields are converted to strings when they're sent to Metadata via the query string,
// Metadata interprets the value "false" as if it were true.
// Therefore, to avoid this confusion, we don't pass the versioning parameter at all if its value is false.
if (versioning) {
options.versioning = true;
}

log.trace('putting object version', {
objectKey: request.objectKey, omVal, options });
return metadata.putObjectMD(bucketName, objectKey, omVal, options, log,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "s3",
"version": "7.10.27",
"version": "7.10.28",
"description": "S3 connector",
"main": "index.js",
"engines": {
Expand Down
Loading

0 comments on commit bd540ba

Please sign in to comment.