小编jhu*_*tas的帖子

在特定管道阶段禁用源代码签出

我有一个具有多个阶段的管道,并且会在所有阶段自动签出源代码。我不需要源代码,只需要发布的工件。

如何禁用特定阶段的源代码签出?

azure-devops azure-devops-pipelines

27
推荐指数
1
解决办法
2万
查看次数

API 名称始终是 SAM 中的堆栈名称

我正在使用 AWS CLI 部署 SAM 模板。

AWS Api 名称设置为与 CloudFormation 堆栈名称相同。我希望根据下面的模板内容将 Api 称为“用户”。

可以设置API名称吗?

SAM 模板:

  MyApi:
    Type: AWS::Serverless::Api
    Properties:
      Name: Users
      StageName: default
Run Code Online (Sandbox Code Playgroud)

使用其他信息进行更新(用于部署的完整模板和 AWS CLI 命令):

模板:

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

Resources:
  HelloFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: main
      Runtime: go1.x
      Events:
        GetEvent:
          Type: Api
          Properties:
            Path: /
            Method: post
            #RestApiId: !Ref ApiGateway1

  LambdaInvokePermission:
    Type: AWS::Lambda::Permission
    Properties:
      FunctionName: !GetAtt
        - HelloFunction
        - Arn
      Action: 'lambda:InvokeFunction'
      Principal: apigateway.amazonaws.com
      SourceAccount: !Ref 'AWS::AccountId'

  MyApi:
    Type: AWS::Serverless::Api
    Properties:
      Name: Users
      StageName: default
      EndpointConfiguration: …
Run Code Online (Sandbox Code Playgroud)

aws-cloudformation aws-lambda aws-sam-cli aws-serverless aws-sam

4
推荐指数
1
解决办法
3403
查看次数

AWS SAM模板/ cloudformation没有为方法定义集成(服务:AmazonApiGateway

我正在尝试部署lambda函数和API网关。我使用AWS CLI创建一个.net核心Web API项目。在AWS Web控制台上仅部署功能并手动创建API网关和资源即可。

如果我确实将API网关包括在模板中,则在通过Web控制台或CLI进行SAM包部署后,出现以下错误:

“没有为方法定义任何集成(服务:AmazonApiGateway;状态代码:400;错误代码:BadRequestException;请求ID:...。)”

这里有什么问题或遗漏吗?

SAM软件包命令:

sam package  --template-file  sam-profile.yaml --output-template-file serverless-output.yaml  --s3-bucket testapp-fewtfvdy-lambda-deployments
Run Code Online (Sandbox Code Playgroud)

SAM模板:

AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
  ProfileFunction:
    Type: AWS::Serverless::Function
    Properties:
      Handler: testapp.Profile.NetCoreVS::testapp.Profile.NetCoreVS.LambdaEntryPoint::FunctionHandlerAsync
      Runtime: dotnetcore2.0
      MemorySize : 128
      Timeout : 5
      CodeUri: bin/Release/netcoreapp2.0/publish
      Events:
        ProfileAny:
          Type: Api
          Properties:
            RestApiId: !Ref ProfileApiGateway
            Path: /profile/v1
            Method: GET

  ProfileApiGateway:
    DependsOn: ProfileFunction
    Type: 'AWS::Serverless::Api'
    Properties:
      StageName: Prod
      DefinitionUri: './swagger.yaml'
Run Code Online (Sandbox Code Playgroud)

swagger.yaml:

---
swagger: '2.0'
info:
  version: v1
  title: ProfileAPI
paths:
  "/profile/v1":
    get:
      tags:
      - Values
      operationId: ProfileV1Get
      consumes: []
      produces: …
Run Code Online (Sandbox Code Playgroud)

aws-cloudformation aws-lambda aws-api-gateway aws-serverless

2
推荐指数
1
解决办法
1815
查看次数