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

Build stage configuration flag "enabled" for provider codebuild not working properly 2 #236

Closed
lordoflairs opened this issue Jan 31, 2020 · 5 comments · Fixed by #335
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@lordoflairs
Copy link

Using pipeline with just source codecommit and then deploy with cloudformation by setting enabled to false for the build step will generate output from source not match input to cloudformation. (InputArtifacts to cloudformation does not match OutputArtifacts from previous step.)

The problem is probably in adf_codepipeline.py but I am not bright enough to figure it out. (Not a Python coder...)

E.g. changeset will be:

        "Stages": [
          {
            "Actions": [
              {
                "ActionTypeId": {
                  "Category": "Source",
                  "Owner": "AWS",
                  "Provider": "CodeCommit",
                  "Version": "1"
                },
                "Configuration": {
                  "BranchName": "master",
                  "RepositoryName": "myRepo",
                  "PollForSourceChanges": false
                },
                "Name": "source",
                "OutputArtifacts": [
                  {
                    "Name": "output-source"
                  }
                ],
                "Region": "eu-west-1",
                "RoleArn": "arn:aws:iam::XXXXXX:role/adf-codecommit-role",
                "RunOrder": 1
              }
            ],
            "Name": "Source-XXXXXX"
          },
          {
            "Actions": [
              {
                "ActionTypeId": {
                  "Category": "Deploy",
                  "Owner": "AWS",
                  "Provider": "CloudFormation",
                  "Version": "1"
                },
                "Configuration": {
                  "ActionMode": "CHANGE_SET_REPLACE",
                  "StackName": "adf-stack-name",
                  "ChangeSetName": "adf-stack-name",
                  "TemplateConfiguration": "stack-name-build::params/CloudCI_eu-west-1.json",
                  "Capabilities": "CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND",
                  "RoleArn": "arn:aws:iam::XXXXXX:role/adf-cloudformation-deployment-role",
                  "TemplatePath": "stack-name-build::template.yml"
                },
                "InputArtifacts": [
                  {
                    "Name": "stack-name-build"
                  }
                ],
                "Name": "CloudCI-eu-west-1-create",
                "Region": "eu-west-1",
                "RoleArn": "arn:aws:iam::XXXXXX:role/adf-cloudformation-role",
                "RunOrder": 1
              },
@lordoflairs
Copy link
Author

Maybe there are more issues to this...
"TemplateConfiguration": "stack-name-build::params/CloudCI_eu-west-1.json"
I guess this means that params are supposed to be generated in build step?

@sbkok
Copy link
Collaborator

sbkok commented Feb 2, 2020

Hi @lordoflairs, thanks reaching out!
@bundyfx tried this in his account and it fails as you described.

For anyone else trying to replicate this, the deployment map specification would look like this:

  - name: sample-pipeline-wo-codebuild
    default_providers:
      source:
        provider: codecommit
        properties:
          account_id: 111111111111
      build:
        properties:
          enabled: False
    targets:
      - /some/target

In ADFs design, it uses the params that you referred to in the last comments to apply tags and generate parameters on an account-by-account basis. When you would add a new account to the OU it targets, it would automatically get the right parameters this way. This step always executes in CodeBuild before it is deployed by CloudFormation.

What are you trying to accomplish here such that it wouldn't need this step?

@lordoflairs
Copy link
Author

lordoflairs commented Feb 3, 2020

Hello @sbkok and thank you for helping out.
We had a simple pipeline that did not need any parameter input.
To me this does not seem like a to uncommon scenario?

For us it was a deploy of a lambda function in the deploy account to relay sns topic information to a teams channel but any infrastructure template.yml that does not require specific parameters would have the same setup.

@lordoflairs
Copy link
Author

For now the workaround is to have a buildstep that have to copy from $S3_BUCKET_NAME and call adf-build/generate_params.py just to genrate an empty parameter file.

@bundyfx
Copy link
Contributor

bundyfx commented Feb 11, 2020

Thanks @lordoflairs - this will be resolved in 3.0.5 coming shortly.

@bundyfx bundyfx added the bug Something isn't working label Feb 17, 2020
@bundyfx bundyfx added this to the v3.0.5 milestone Feb 17, 2020
@sbkok sbkok modified the milestones: v3.0.5, v3.1.1 Mar 1, 2021
@sbkok sbkok self-assigned this Mar 1, 2021
sbkok added a commit to sbkok/aws-deployment-framework that referenced this issue Mar 3, 2021
…sabled

**Why?**

When the build stage is disabled, the deploy stages incorrectly tried to
use the build output artifact. These should use the source artifact
instead.

**Linked issues**

* awslabs#236
* awslabs#318
sbkok added a commit that referenced this issue Mar 3, 2021
…sabled (#334)

**Why?**

When the build stage is disabled, the deploy stages incorrectly tried to
use the build output artifact. These should use the source artifact
instead.

**Linked issues**

* #236
* #318
sbkok added a commit to sbkok/aws-deployment-framework that referenced this issue Mar 3, 2021
**Fixes 🐞**

* Fixes `timeout` and `environment_variables` to be used when defined in
  the default CodeBuild Deployment provider properties awslabs#307, closes awslabs#306.
* Fixes intrinsic functions for account_region param files awslabs#333, closes awslabs#147.
* Fixes use of deployment from source directly when build stage is
  disabled awslabs#334, closes awslabs#236 and closes awslabs#318.
@sbkok sbkok mentioned this issue Mar 3, 2021
@sbkok sbkok closed this as completed in #335 Mar 3, 2021
sbkok added a commit that referenced this issue Mar 3, 2021
**Fixes 🐞**

* Fixes `timeout` and `environment_variables` to be used when defined in
  the default CodeBuild Deployment provider properties #307, closes #306.
* Fixes intrinsic functions for account_region param files #333, closes #147.
* Fixes use of deployment from source directly when build stage is
  disabled #334, closes #236 and closes #318.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants