我的.travis.yml文件在第25行的错误处:on:branch:master确切的错误是
[x]语法错误:():在此上下文中,第25行第5列不允许映射值
我正在尝试根据要推送到的分支进行两个不同的部署。
language: node_js
node_js:
- 10.8.0
cache:
directories:
- node_modules
services:
- mongodb
- docker
before_install:
- pip install --user awscli
- export PATH=$PATH:$HOME/.local/bin
install:
- npm install
before_script:
- npm run lint
script:
- npm run test
deploy:
# Production Deploy if we push to master
- eval $(aws ecr get-login --no-include-email --region us-east-1)
- docker build -t production-my-api .
- docker tag production-my-api:latest 989002346127.dkr.ecr.us-east-1.amazonaws.com/production-my-api:latest
- docker push 989002346127.dkr.ecr.us-east-1.amazonaws.com/production-my-api:latest
on:
branch: master
# Develop Deploy if we push to develop
- eval $(aws ecr get-login --no-include-email --region us-east-1)
- docker build -t develop-my-api .
- docker tag develop-my-api:latest 989002346127.dkr.ecr.us-east-1.amazonaws.com/develop-my-api:latest
- docker push 989002346127.dkr.ecr.us-east-1.amazonaws.com/develop-my-api:latest
on:
branch: develop
env:
global:
- secure: bNqX0zh25lC0LSvmpZqgKoHLyOoFKiHJxo5c52vo3BIJ6vqNAep9Ke5huiYYlA7IEbIBHAQcdYPbrSsSc8mCDtMTgNz5lDVCBvxKeYR6AtBHxMOf34AAjkbW5HK0Gy5KBs1Tj4EhAq0/7hPZF0S8rfuyfGPl2oIsx0MorHGCL9KG7LyAqZj+EXXbb71iky14ZD22yUbHFw8gmVmnX5ANGKYTg6rsX03ppy4V3H8iSG9VtatS5msl1xTG1Rgg1geSX95fMBE9Mzl+v6ZgSWf/WCyjUp5mwoTMJk+CtJrEcpoBQkRoMFa9pJeF/wlIgPuqfv7mbACv6IFiBx35KgONkT0Wvn6iEvbhA7Nxdy2thzAkc8Uo+73lqsjh799akZT4+4clUxilUzGsUbUPnvQf5fJYsO1cU/hIw9qPOFVlrib6tsDCaUQ8kpbo+kx7GgtNrp+AV7IZE0TTiOdpXTMv81vHGBmI5/trNeyEuhVFczlR9Ckk9F2j6x41WRkbYwoxH0xjdUUkl7QLMHz/wD7BjwaFpSCIid5FaNcTEaYU0pPs0d/2O9imyNolY6JFf/Fo6+twOrjKsFcgXrlVh3hA9CYmke1vccC847bzzbpKd3Q+g2q2JDe41HKBjs7AXIUIJZjA6RyV0+UTfCZYV0t3b18T7HkUPlcXpA6qVSOUR8E=
- secure: QN4RvzMHgm/13R86go2ba64JZWtWayaq9j34SWzJQuSwZA0vnVpagX1HYfLXZkkI57AD5uJOJsfQP4jDMF9BXA1SFMCHuUV5Fvnk7r7LlKuZoo58ppaaEXYtk/bBQd19ITZOR7SNEbOrR4Sp0KaimhGNOzJhZ4Uv9nCNvK9A+dfNT5MZ3qrWl6WbQRcvdw6iyz54Qz7Ckz/Lp6zq+VHoyDp3rymoD1wayMSSoodyStXjeftqBCfuRiXwXuo03MEgTyphF4Bbjxxkt9DOLmFuKnuYPK3gZuAShu49pwFSYCG5C0FN51tFtO60ojCLs+J6sLa7w5+U4XNFvvv6egUOBxpm+lHINdPx6LpVV4Qm8uVUJkxR2par3paRdWrPdCyqMBVGM1t+T7LP20F7YmI8Ds5fVfbQmTiKCNz5daP/AXtxrWjivdZq3stCAcloW8X/H11X11GzBDxMRAGUg2+9lpMgpTGeNoDBmeyf1NXwdxBsg1d+ISdqk6ZLIO49RmFqKrgT9qwg7bMcpEMfGmXMrHTyuLMXNVkZSkCq1KT3RlymFUzR1qEQvIFyDVFJhTIpBYlIjFgckDRTh/hLqywq3gEKkcSxlQwyBDp3Rw59nK/xl+TtCMNgj8TDWIw1XELSTRUbPugBZOde6zpV1PMUEsEwERIrQ2La+llKXz0+V1s=
答案 0 :(得分:-1)
deploy_production.sh
#!/bin/bash
# Deploy to develop
echo "Deploying to ACS"
$(aws ecr get-login --no-include-email --region us-east-1)
docker build -t develop-my-api .
docker tag develop-my-api:latest 989002346127.dkr.ecr.us-east-1.amazonaws.com/develop-my-api:latest
docker push 989002346127.dkr.ecr.us-east-1.amazonaws.com/develop-my-api:latest
并且不要忘记更改权限chmod + x deploy_production.sh