Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Status](https://travis-ci.org/awslabs/aws-sam-cli.svg?branch=develop)
![GitHub-release](https://img.shields.io/github/release/awslabs/aws-sam-cli.svg)
![PyPI version](https://badge.fury.io/py/aws-sam-cli.svg)

[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/aws-sam-cli)

[Join the SAM developers channel (\#samdev) on
Slack](https://join.slack.com/t/awsdevelopers/shared_invite/enQtMzg3NTc5OTM2MzcxLTdjYTdhYWE3OTQyYTU4Njk1ZWY4Y2ZjYjBhMTUxNGYzNDg5MWQ1ZTc5MTRlOGY0OTI4NTdlZTMwNmI5YTgwOGM/)
to collaborate with fellow community members and the AWS SAM team.
Expand Down
5 changes: 5 additions & 0 deletions snap/local/launchers/launcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

HOME="$(getent passwd "${USER}" | cut -d: -f6)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: Why do you need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you've merged already but this is because, by default, within the snap's runtime $HOME is set to another folder. SAM needs access to the user's ~/.aws (granted by the personal-files plug) so we need to set $HOME to the proper folder :)


exec "${@}"
50 changes: 50 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: aws-sam-cli
version: git
summary: The AWS SAM CLI tool for the AWS Serverless Application Model
description: >
`sam` is the AWS CLI tool for managing Serverless applications written
with the AWS Serverless Application Model (SAM).
SAM CLI can be used to test functions locally, start a local API Gateway
from a SAM template, validate a SAM template, fetch logs, generate sample
payloads for various event sources, and generate a SAM project in your
favorite Lambda Runtime.

license: Apache-2.0

base: core18

grade: stable
confinement: strict

plugs:
personal-files:
read:
- $HOME/.aws

parts:
launchers:
plugin: dump
source: snap/local/launchers
organize:
"*": bin/

aws-sam-cli:
plugin: python
python-version: python3
python-packages:
- awscli
requirements:
- requirements/base.txt
source: .

apps:
aws-sam-cli:
adapter: full
command-chain:
- bin/launcher.sh
command: bin/sam
#plugs:
# - home
environment:
LC_ALL: C.UTF-8
LANG: C.UTF-8