Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ebrains-spack-builds
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Klaus Noelp
ebrains-spack-builds
Commits
555c7520
Commit
555c7520
authored
3 years ago
by
Athanasios Karmas
Browse files
Options
Downloads
Patches
Plain Diff
Add new file to upload to Swift S3 API
parent
28dcdc40
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
upload_to_s3_api.sh
+25
-0
25 additions, 0 deletions
upload_to_s3_api.sh
with
25 additions
and
0 deletions
upload_to_s3_api.sh
0 → 100644
+
25
−
0
View file @
555c7520
#!/bin/bash
# about the file
file_to_upload
=
$1
bucket
=
$2
filepath
=
"/
${
bucket
}
/
${
file_to_upload
}
"
# metadata
contentType
=
"application/x-compressed-tar"
dateValue
=
`
date
-R
`
signature_string
=
"PUT
\n\n
${
contentType
}
\n
${
dateValue
}
\n
${
filepath
}
"
#s3 keys
s3_access_key
=
$3
s3_secret_key
=
$4
#prepare signature hash to be sent in Authorization header
signature_hash
=
`
echo
-en
${
signature_string
}
| openssl sha1
-hmac
${
s3_secret_key
}
-binary
|
base64
`
# actual curl command to do PUT operation on s3
curl
-X
PUT
-T
"
${
file_to_upload
}
"
\
-H
"Host: object.cscs.ch:443/
${
bucket
}
"
\
-H
"Date:
${
dateValue
}
"
\
-H
"Content-Type:
${
contentType
}
"
\
-H
"Authorization: AWS
${
s3_access_key
}
:
${
signature_hash
}
"
\
https://object.cscs.ch/
${
bucket
}
/
${
file_to_upload
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment