How to hide aws cer get-login-password output

Viewed 384

I am using AWS(CLI v2) ECR login command in Jenkins pipeline as below where the password is getting printed to stdout when my bash env is set in -v mode.

            steps {
                    sh '''#!/bin/bash
                        set -xv
                        docker login --username AWS --password $(aws ecr get-login-password) $(aws sts get-caller-identity --query Account --output text).dkr.ecr.us-east-1.amazonaws.com
                        docker push "${imageTag}"
                        docker logout $(aws sts get-caller-identity --query Account --output text).dkr.ecr.us-east-1.amazonaws.com
                        '''
            }

Any better secure way to do this?

0 Answers
Related