Skip to content

add docker fine grained permission to the plugin #391

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

Merged
merged 2 commits into from
Oct 8, 2024
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: 1 addition & 1 deletion Examples/APIGateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To build the package, type the following commands.

```bash
swift build
swift package archive --disable-sandbox
swift package archive --allow-network-access docker
```

If there is no error, there is a ZIP file ready to deploy.
Expand Down
2 changes: 1 addition & 1 deletion Examples/HelloWorld/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To build & archive the package, type the following commands.

```bash
swift build
swift package archive --disable-sandbox
swift package archive --allow-network-access docker
```

If there is no error, there is a ZIP file ready to deploy.
Expand Down
8 changes: 7 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ let package = Package(
verb: "archive",
description:
"Archive the Lambda binary and prepare it for uploading to AWS. Requires docker on macOS or non Amazonlinux 2 distributions."
)
),
permissions: [
.allowNetworkConnections(
scope: .docker,
reason: "This plugin uses Docker to create the AWS Lambda ZIP package."
)
]
)
),
.testTarget(
Expand Down
2 changes: 1 addition & 1 deletion Plugins/AWSLambdaPackager/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ struct AWSLambdaPackager: CommandPlugin {

REQUIREMENTS: To use this plugin, you must have docker installed and started.

USAGE: swift package --disable-sandbox archive [--help] [--verbose]
USAGE: swift package --allow-network-access docker archive [--help] [--verbose]
[--output-directory <path>]
[--products <list of products>]
[--configuration debug | release]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
swift package --disable-sandbox plugin archive
swift package --allow-network-access docker plugin archive

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
swift package --disable-sandbox plugin archive
swift package --allow-network-access docker archive

-------------------------------------------------------------------------
building "squarenumberlambda" in docker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
swift package --disable-sandbox plugin archive
swift package --allow-network-access docker archive

-------------------------------------------------------------------------
building "squarenumberlambda" in docker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ AWS Lambda runtime runs on Amazon Linux. You must compile your code for Amazon L
> Be sure to have [Docker](https://docs.docker.com/desktop/install/mac-install/) installed for this step.

```sh
swift package --disable-sandbox plugin archive
swift package --allow-network-access docker archive

-------------------------------------------------------------------------
building "squarenumberlambda" in docker
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ try await runtime.run()

```bash
swift build
swift package archive --disable-sandbox
swift package archive --allow-network-access docker
```

If there is no error, there is a ZIP file ready to deploy.
Expand Down
Loading