amazon-ecs - Github 操作错误:需要输入但未提供:任务定义
问题描述
[![在此处输入图像描述][2]][2]
on:
push:
branches:
- soubhagya
name: Deploy to Amazon ECS
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: af-south-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: new-cgafrica-backend
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
- name: Fill in the new image ID in the Amazon ECS task definition
id: cgafrica-new-backend-task
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: cgafrica-backend-container
image: ${{ steps.build-image.outputs.image }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: cgafrica-backend-service
cluster: cgafrica-backend-cluster
wait-for-service-stability: true
这是我添加的 yaml 文件代码。请检查
我已经分享了我的 task-definition.json 和 github 操作管道进度。但是,我收到一些错误输入需要但未提供:任务定义请让我知道这里有什么问题
解决方案
问题出在最后一步——Deploy Amazon ECS task definition
有问题的部分是${{ steps.task-def.outputs.task-definition }}
不涉及现有步骤。没有步骤 id task-def
。
为了工作,它应该是:${{ steps.cgafrica-new-backend-task.outputs.task-definition }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.cgafrica-new-backend-task.outputs.task-definition }}
service: cgafrica-backend-service
cluster: cgafrica-backend-cluster
wait-for-service-stability: true
推荐阅读
- reactjs - 反应本机导航未定义对象错误
- machine-learning - OneHotEncoder 的参数:类别
- wordpress - woocommerce中的多种货币未显示
- python - Pandas GroupBy - 在保留原始顺序的同时将功能应用于每个组
- c# - EF Core 抛出“'this' 类型不能是接口本身。”
- node.js - 如何通过 Facebook Marketing API 更新 Adsets(嵌套)定位选项?
- swift - Swift,试图创建一个保持登录状态,但是实现的代码不起作用
- java - Java import org.mockito 报错包不存在
- c++ - 如何编译使用循环引用的代码?
- swift - 如何从 WatchOS 的 SwiftUI 列表中删除分隔符?