mercredi 28 août 2019

jenkinsfile - copy files to s3 and make public

I am uploading a website to an s3 bucket for hosting, I upload from a jenkins build job using this in the jenkins file

withAWS(credentials:'aws-cred') {

             sh 'npm install'
             sh 'ng build --prod'
             s3Upload(
                       file: 'dist/topic-creation',
                       bucket: 'bucketName',
                       acl:'PublicRead'
                     )
        }


After this step I go to the s3 bucket and get the URL (I have configured the bucket for hosting), when i go to the endpoint url I get a 403 error. When i go back to bucket and give all the items that got uploaded public access, then the URL brings me to my website.

I don't want to make the bucket public, I want to give the files public access, I thought adding the line acl:'PublicRead' which can be seen above would do this but it does not.

Can anyone tell me how I can upload the files and give public access from a jenkins file?

Thanks




Aucun commentaire:

Enregistrer un commentaire