I am executing a GitHub action to push a Docker image into AWS ECR and Lightsail.
While pushing into ECR works, it fails silently in the following block.
- name: Push the Docker Image to lightsail
env:
IMAGE_SHA_TAG: ${{ github.sha }}
IMAGE_URL: ${{ format('{0}{1}{2}', vars.LIGHTSAIL_IMAGE ,':', github.sha) }}
run: >
aws lightsail push-container-image
--region ${{ vars.AWS_REGION }}
--service-name ${{ vars.SERVICE_NAME }}
--label git-push
--image $IMAGE_URL
In the log, the command doesn’t throw any error.
But after running the following block, The LIGHTSAIL_DOCKER_IMAGE
is empty.
- name: Save updated LIGHTSAIL_IMAGE_TAG
run: |
echo "LIGHTSAIL_DOCKER_IMAGE=$(aws lightsail get-container-images --service-name ${{ vars.SERVICE_NAME }} --region ${{ vars.AWS_REGION }} | jq -r .containerImages[0].image)" >> $GITHUB_ENV
echo "LIGHTSAIL_DOCKER_IMAGE=$LIGHTSAIL_DOCKER_IMAGE"
If I execute locally
aws lightsail get-container-images --service-name ${{ vars.SERVICE_NAME }} --region ${{ vars.AWS_REGION }}
I get
{
"containerImages": []
}