To set up your bucket on the objectstore perform these steps

get your objectstore key id and secret from the s3 objectstore admin
install aws cli
run: aws configure
enter the aws id and secret
enter region, for s3-lux.obj.cec.eu.int this should be lux
enter format lux

check which root certificate is in use, can be done by opening the https url in browser and viewing the certificate info
export the relevant root certificate in pem format:
    On windows you should open computer certificates manager
    Open the Trusted Root Certification Authorities -> Certificates and find the root certificate in use
    Export that certificate as DER encoded binary in .cer format
    On a linux (ubuntu in this case) convert the cer file to a pem by running: openssl x509 -inform der -in yourfile.cer -out yourfile.pem
This file should be read and included in the s3ClientConfig of the ObjectStorePublisher example:

const ObjectStoreRootCert = [
  fs.readFileSync("./apps/my-workplace-e2e-wd/cert/ecrootca2.pem")
];
ObjectStorePublisher config:
        {
          type: ObjectStorePublisher,
          config: {
            publish: 'always',  // never, fail or always
            s3ClientConfig: {
              endpoint: "https://s3-lux.obj.cec.eu.int",
              region: "lux",
              signatureVersion: "v4",
              httpOptions: {ca: ObjectStoreRootCert}
            },
            dirPath: "allure-report-e2e",
            s3Bucket: "e2e-test-results",
            s3rootKey: "-e2e-trial-report",
            prefixRootKeyWithTime: true,
            // Check Canned ACL of https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html
            acl:"public-read",
            indexFile: "index.html"
          }
        }

set the root certificate as the root cert to be used by AWS cli to continue by adding it as an env var example:
export AWS_CA_BUNDLE="/home/devlin/EcIntRootCa.pem"

Command to create a bucket:
aws --endpoint="https://s3-lux.obj.cec.eu.int" s3 mb s3://your-bucket-name

View existing buckets to verify bucket creation:
aws --endpoint="https://s3-lux.obj.cec.eu.int" s3 ls

Delete a bucket:
aws --endpoint="https://s3-lux.obj.cec.eu.int" s3 rb s3://your-bucket-name

If you wish to make access to files created in the bucket bublic configure the bucket to allow public access:
aws s3api put-public-access-block --endpoint="https://s3-lux.obj.cec.eu.int" --bucket your-bucket-name --public-access-block-configuration "BlockPublicAcls=false,IgnorePublicAcls=false,BlockPublicPolicy=false,RestrictPublicBuckets=false"

in the config of your publisher make sure to add the acl entry as shown above for public access.



