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

ScriptLocation is not updated for Glue::Job when building #1537

Closed
wnkz opened this issue Nov 15, 2019 · 4 comments
Closed

ScriptLocation is not updated for Glue::Job when building #1537

wnkz opened this issue Nov 15, 2019 · 4 comments
Labels
contributors/good-first-issue Good first issue for a contributor stage/waiting-for-release Fix has been merged to develop and is waiting for a release type/bug

Comments

@wnkz
Copy link

wnkz commented Nov 15, 2019

Description

When running sam build ; AWS::Glue::Job Command.ScriptLocation's path is not updated in .aws-sam/build/template.yaml.

My real template includes Serverless::Functions so I need to run build and cannot just use package.
This works just fine for other resources supported by sam package (e.g. AWS::CloudFormation::Stack) but not for Glue Jobs.

Steps to reproduce

template.yml

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31

Resources:
  GlueJob:
    Type: AWS::Glue::Job
    Properties:
      GlueVersion: '1.0'
      MaxCapacity: 5
      Command:
        Name: glueetl
        PythonVersion: '3'
        ScriptLocation: glue.py
      Role: !GetAtt GlueServiceRole.Arn

  GlueServiceRole:
    Type: AWS::IAM::Role
    Properties:
      Path: /service-role/
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
          - Effect: Allow
            Principal:
              Service:
                - glue.amazonaws.com
            Action:
              - sts:AssumeRole
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/service-role/AWSGlueServiceRole
sam build

Observed result

.aws-sam/build/template.yaml

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
  GlueJob:
    Type: AWS::Glue::Job
    Properties:
      GlueVersion: '1.0'
      MaxCapacity: 5
      Command:
        Name: glueetl
        PythonVersion: '3'
        ScriptLocation: glue.py
      Role:
        Fn::GetAtt:
        - GlueServiceRole
        - Arn
  GlueServiceRole:
    Type: AWS::IAM::Role
    Properties:
      Path: /service-role/
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
        - Effect: Allow
          Principal:
            Service:
            - glue.amazonaws.com
          Action:
          - sts:AssumeRole
      ManagedPolicyArns:
      - arn:aws:iam::aws:policy/service-role/AWSGlueServiceRole

Command.ScriptLocation is left untouched.

Expected result

.aws-sam/build/template.yaml

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
  GlueJob:
    Type: AWS::Glue::Job
    Properties:
      GlueVersion: '1.0'
      MaxCapacity: 5
      Command:
        Name: glueetl
        PythonVersion: '3'
        ScriptLocation: ../../glue.py
      Role:
        Fn::GetAtt:
        - GlueServiceRole
        - Arn
  GlueServiceRole:
    Type: AWS::IAM::Role
    Properties:
      Path: /service-role/
      AssumeRolePolicyDocument:
        Version: 2012-10-17
        Statement:
        - Effect: Allow
          Principal:
            Service:
            - glue.amazonaws.com
          Action:
          - sts:AssumeRole
      ManagedPolicyArns:
      - arn:aws:iam::aws:policy/service-role/AWSGlueServiceRole

Command.ScriptLocation should be updated.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: macOS 10.15.1
  2. sam --version: SAM CLI, version 0.31.1
@wnkz
Copy link
Author

wnkz commented Nov 15, 2019

@sanathkr
Copy link
Contributor

Thanks for diving deep and finding the root cause. It should be a simple bugfix to support dot notations in the path_prop_name variables under samcli/commands/_utils/template.py

@sanathkr sanathkr added contributors/good-first-issue Good first issue for a contributor type/bug labels Nov 15, 2019
wingkwong added a commit to wingkwong/aws-sam-cli that referenced this issue Nov 19, 2019
@jfuss jfuss added the stage/waiting-for-release Fix has been merged to develop and is waiting for a release label Jan 17, 2020
@wnkz
Copy link
Author

wnkz commented Jan 20, 2020

@wingkwong Nice changes in #1537 ; had no idea set_value_from_jmespath even existed.
@jfuss Any idea of when this fix will be released?

@awood45
Copy link
Member

awood45 commented Feb 6, 2020

The fix for this has been released, closing.

@awood45 awood45 closed this as completed Feb 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributors/good-first-issue Good first issue for a contributor stage/waiting-for-release Fix has been merged to develop and is waiting for a release type/bug
Projects
None yet
Development

No branches or pull requests

4 participants