Bitbucket管道-找不到命名的应用程序版本 [英] Bitbucket Pipelines - No Application Version named found

查看:78
本文介绍了Bitbucket管道-找不到命名的应用程序版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用bitbucket管道将 django 项目部署到Elasticbeanstalk.

I'm trying to deploy django project to elasticbeanstalk using bitbucket pipelines.

这是我的配置

image: python:3.7.2

pipelines:
  branches:
      master:
        - step:
            script: 
              - pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.5
                variables:
                  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
                  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
                  AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
                  APPLICATION_NAME: $APPLICATION_NAME
                  COMMAND: $COMMAND
                  ENVIRONMENT_NAME: $ENVIRONMENT_NAME
                  VERSION_LABEL: ${ENVIRONMENT_NAME}_${BITBUCKET_COMMIT:0:8}_(YYYY-mm-dd_HHMMSS)
                  WAIT: 'true'
              - pip3 install -r requirements.txt
              - python3 manage.py makemigrations
              - python3 manage.py migrate
              - python3 manage.py collectstatic

我收到以下错误:

An error occurred (InvalidParameterValue) when calling the UpdateEnvironment operation: No Application Version named 'production_d095cbe2_YYYY-mm-dd_HHMMSS)' found.

我只是想知道,是不是应该有年份和时间范围而不是 YYYY-mm-dd_HHMMSS ?

I'm just wondering, shouldn't it have year and time frame instead of the YYYY-mm-dd_HHMMSS?

推荐答案

好吧,如果您想要日期和时间,则可以调用 date 函数:

Well, if you want the date and time you can invoke the date function of the underlaying linux container:

date +"%Y-%m-d_%H%M%S" # displays 2019-03-26_223932

因此,您的 bitbucket-piplines.yml 应该按照您期望的方式进行写:

So your bitbucket-piplines.yml should do what you expect written this way:

图片:python:3.7.2

image: python:3.7.2

pipelines:
  branches:
      master:
        - step:
            script: 
              - pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.5
                variables:
                  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
                  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
                  AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
                  APPLICATION_NAME: $APPLICATION_NAME
                  COMMAND: $COMMAND
                  ENVIRONMENT_NAME: $ENVIRONMENT_NAME
                  VERSION_LABEL: ${ENVIRONMENT_NAME}_${BITBUCKET_COMMIT:0:8}_$(date +"%Y-%m-d_%H%M%S")
                  WAIT: 'true'
              - pip3 install -r requirements.txt
              - python3 manage.py makemigrations
              - python3 manage.py migrate
              - python3 manage.py collectstatic

这篇关于Bitbucket管道-找不到命名的应用程序版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆