def execute()

in aws_lambda_builders/workflows/dotnet_clipackage/actions.py [0:0]


    def execute(self):
        try:
            LOG.debug("Running `dotnet lambda package` in %s", self.source_dir)

            zipfilename = os.path.basename(os.path.normpath(self.source_dir)) + ".zip"
            zipfullpath = os.path.join(self.artifacts_dir, zipfilename)

            arguments = [
                "lambda",
                "package",
                "--output-package",
                zipfullpath,
                # Pass function architecture to Amazon Lambda Tools.
                "--function-architecture",
                self.architecture,
                # Specify the architecture with the --runtime MSBuild parameter
                "--msbuild-parameters",
                "--runtime " + self._get_runtime(),
            ]

            if self.mode and self.mode.lower() == BuildMode.DEBUG:
                LOG.debug("Debug build requested: Setting configuration to Debug")
                arguments += ["--configuration", "Debug"]

            if self.options is not None:
                for key in self.options:
                    if str.startswith(key, "-"):
                        arguments.append(key)
                        arguments.append(self.options[key])

            self.subprocess_dotnet.run(arguments, cwd=self.source_dir)

            # The dotnet lambda package command outputs a zip file for the package. To make this compatible
            # with the workflow, unzip the zip file into the artifacts directory and then delete the zip archive.
            self.os_utils.unzip(zipfullpath, self.artifacts_dir)

        except DotnetCLIExecutionError as ex:
            raise ActionFailedError(str(ex))