aws-toolkit-azure-devops icon indicating copy to clipboard operation
aws-toolkit-azure-devops copied to clipboard

Deploy SAM

Open ghost opened this issue 4 years ago • 9 comments

Feature request - Deploy SAM packages support.

Deploying SAM packages is still a little bit of a pain via VSTS / Azure DevOps. would be good to have the tooling including as part of the aws-vsts-tools project.

The ability to deploy a SAM package from Local File or From Public Github Repo.

ghost avatar Oct 21 '19 21:10 ghost

We use SAM in both our pipeline and release, and this will result in that we will need to install SAM CLI many times (each time we build & release).

The prefered method of using brew will also require installation of brew. Last week there was a commit in brew master that break the installation and the current recommended method there is no way to use anything else than master. https://github.com/Homebrew/brew/commit/d3459161de54ad64232e490d551a2c4e6f6aab2e

SAM CLI installation on linux

We moved over to be using pip in our pipelines that solved the issue.

Best would be if we get a task available that has sam cli ready to run without any installation. This works for aws cli, and a task with support of aws sam cli would increase both speed and stability.

JohGiz avatar Mar 12 '20 11:03 JohGiz

Very useful feature request

mannharleen avatar May 20 '20 13:05 mannharleen

Would very much like this, I'm losing 3-4mins installing via pip

karl-barbour avatar Jun 18 '20 16:06 karl-barbour

+1 for this feature request. Edit: Actually I see the current hosted images include the AWS SAM CLI 1.0 https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md

bbarman4u avatar Aug 11 '20 23:08 bbarman4u

consider adding your upvote 👍 to the main description so it will be counted when comparing requests in this project.

justinmk3 avatar Aug 12 '20 00:08 justinmk3

@JohGiz how do you manage the AWS credentials for SAM? Are you using pipeline variables or AWS service connection? I'm using an AWS service connection but trying to find a way to pass the credentials to SAM.

curtrube avatar Aug 19 '20 05:08 curtrube

@JohGiz how do you manage the AWS credentials for SAM? Are you using pipeline variables or AWS service connection? I'm using an AWS service connection but trying to find a way to pass the credentials to SAM.

We just use the AWSShellScript task using one of the service connections setup for the account connection to AWS. This is a task that we run to use sam build on our pipelines:

           - task: AWSShellScript@1
            displayName: AWS SAM build
            inputs:
              awsCredentials: $(serviceConnectionName)
              regionName: $(awsRegion)
              scriptType: 'inline'
              inlineScript: |
                sam --version
                sam build --use-container --template-file $(cloudformationTemplate)

JohGiz avatar Aug 20 '20 06:08 JohGiz

Hi I create this azure-pipelines.yml to deploy SAM in Azure DevOps

pool:
    vmImage: 'ubuntu-latest'

steps:
        - bash: sudo apt update -y
          displayName: "instalando updates"
        - bash: sudo apt upgrade -y
          displayName: "instalando upgrades"
        - bash: sudo apt-get install curl apt-transport-https ca-certificates software-properties-common -y
          displayName: "instalando curl apt-transport-https ca-certificates software-properties-common"
        - bash: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
          displayName: "instalando dependencias de Docker para SAM"
        - bash: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
          displayName: "instalando repo docker para SAM"
        - bash: sudo apt update
          displayName: "Actualizando repo"
        - bash: sudo apt-cache policy docker-ce
          displayName: "Verificando repo docker"
        - bash: sudo apt install docker-ce
          displayName: "Instalando Docker "
        - bash: sudo systemctl status docker
          displayName: "Verificando servicio de docker"
        - bash: sudo usermod -aG docker ${USER}
          displayName: "Agregando permisos a docker"
        - bash: sudo apt install build-essential -y
          displayName: "Insyalando dependenciad de LinuxBrew"
        - bash: sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
          displayName: "Instalando LinuxBrew"
        - bash: echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> /home/vsts/.bash_profile
          displayName: "Instanado variable de LinuxBrew 1"
        - bash: eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
          displayName: "Instanado variable de LinuxBrew 2"
        - bash: brew --version
          displayName: "Verificando version de brew"
        - bash: brew tap aws/tap
          displayName: "Instalando tap AWS para brew"
        - bash: brew install aws-sam-cli
          displayName: "Instalando cli AWS para brew"
        - bash: aws configure set aws_access_key_id  $(accesskey)
          displayName: "Configurardo aws_access_key_id"
        - bash: aws configure set aws_secret_access_key $(secretacceskey)
          displayName: "Configurardo aws_secret_access_key"
        - bash: aws configure set region us-west-1
          displayName: "Configurardo Region de despligue de AWS"
        - bash: sam --version
          displayName: "Verificando version de SAM"
        - bash: sam validate -t template.yaml
          displayName: "Validacion CF"
        - bash: sam build --use-container
          displayName: "Versionamiento, verificacion de lambdas y construccion de CF para SAM"
        - bash: sam deploy --no-confirm-changeset
          displayName: "Deploy de SAM"

danf22 avatar Aug 29 '20 05:08 danf22

Two years and still no movement on this feature request !! Seems like Azure DevOps backing by MSFT is dwindling.

bbarman4u avatar Jul 11 '21 04:07 bbarman4u