Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't download artifacts from S3 #111

Open
emaks opened this issue Jul 9, 2021 · 1 comment
Open

Can't download artifacts from S3 #111

emaks opened this issue Jul 9, 2021 · 1 comment

Comments

@emaks
Copy link

emaks commented Jul 9, 2021

I have buildspec.yml

version: 0.2

phases:
  build:
    commands:
      - #some commands
artifacts:
  files: '**/*'
  base-directory: <project-folder>

and in Jenkinsfile configuration for run CodeBuild

stage('Execute CodeBuild') {
    steps {
        withAWS(region: params.region, role: params.role, roleAccount: params.sdlcAccount) {
            awsCodeBuild(
                credentialsType: 'keys',
                projectName: "${params.codebuildProject}",
                region: "${params.region}",
                sourceControlType: 'jenkins',
                sourceTypeOverride: 'S3',
                sourceLocationOverride: "${params.s3Bucket}/tests/${JOB_BASE_NAME}/${BUILD_ID}/source.zip",
                buildSpecFile: '.jenkins/bat-api/buildspec.yml',
                envVariables: "[{ENV,${params.env}},{REGION,${getRegion()}}]",
                artifactTypeOverride: 'S3',
                artifactPackagingOverride: 'ZIP',
                artifactLocationOverride: "${params.s3Bucket}",
                artifactPathOverride: "tests/${JOB_BASE_NAME}/${BUILD_ID}",
                artifactNameOverride: 'results.zip',
                downloadArtifacts: 'true',
                downloadArtifactsRelativePath: ''
            )
        }
    }
}

When I execute jenkins job I get error

[AWS CodeBuild Plugin] Downloading artifact from location 'arn:aws:s3:::${params.s3Bucket}/tests/${JOB_BASE_NAME}/${BUILD_ID}/results.zip' to path:/home/jenkins/workspace/${JOB_BASE_NAME}/tests/${JOB_BASE_NAME}/${BUILD_ID}/results.zip
[AWS CodeBuild Plugin] Failed to create directory /home/jenkins/workspace/${JOB_BASE_NAME}/tests/${JOB_BASE_NAME}/${BUILD_ID}

If I remove downloadArtifacts: 'true' and add separate step

s3Download(bucket: "${params.s3Bucket}", path: "tests/${JOB_BASE_NAME}/${BUILD_ID}/results.zip", file: 'results.zip')

everything work fine

I also tried to execute command before

sh "mkdir -p tests/${JOB_BASE_NAME}/${BUILD_ID}"

Expected result
/home/jenkins/workspace/${JOB_BASE_NAME}/results.zip exists

@emaks
Copy link
Author

emaks commented Jul 26, 2021

@leoherran-aws @josephvusich Could you take a look, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant