Bitbucket Pipelines - No Application Version named found

余生颓废 提交于 2021-02-11 14:53:29

问题


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

Here's my config

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

I get the following error :

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

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


回答1:


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

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

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


来源:https://stackoverflow.com/questions/55313188/bitbucket-pipelines-no-application-version-named-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!