我們正在使用 Github Actions 在 AWS ELB 中實作我們的 CI/CD 管道。我們的作業流程之一是使用命令“aws elasticbeanstalk request-environment-info”和“ aws elasticbeanstalk retrieve-environment-info ”請求日志。問題是當 Github 代理從 AWS 獲取資訊時,它隱藏了在 AWS 中獲取日志的 URL。
name: Request logs
env:
EB_PACKAGE_S3_BUCKET_NAME : "s3bucket"
EB_APPLICATION_NAME : "appname"
AWS_REGION_NAME : "us-east-2"
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
environment_name:
type: choice
description: Select the environment to get logs from
required: true
options:
- app-dev
- app-prod
info_type:
type: choice
description: 100 last lines (tail) or full log (bundle)
required: true
options:
- "tail"
- "bundle"
jobs:
RequestLogs:
runs-on: ubuntu-latest
steps:
- name: Configure my AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id : ${{ secrets.MY_AWS_ACCES_KEY }}
aws-secret-access-key: ${{ secrets.MY_AWS_SECRET_KEY }}
aws-region : ${{ env.AWS_REGION_NAME }}
- name: Request logs
run : |
aws elasticbeanstalk request-environment-info \
--environment-name ${{ github.event.inputs.environment_name }} \
--info-type ${{ github.event.inputs.info_type }}
- name: Sleep for 30 seconds
uses: jakejarvis/wait-action@master
with:
time: '30s'
- name: Retrieve logs
run : |
aws elasticbeanstalk retrieve-environment-info \
--environment-name ${{ github.event.inputs.environment_name }} \
--info-type ${{ github.event.inputs.info_type }}
預期回應:
"EnvironmentInfo": [
{
"InfoType": "tail",
"Ec2InstanceId": "intanceid",
"SampleTimestamp": "date and time",
"Message": "https://elasticbeanstalk-us-east-2-123456789.s3.us-east-2.amazonaws.com/resources/environments/logs/someHeaders"
}
真實回應:
"EnvironmentInfo": [
{
"InfoType": "tail",
"Ec2InstanceId": "intanceid",
"SampleTimestamp": "date and time",
"Message": "https://elasticbeanstalk-us-east-2-*******.s3.us-east-2.amazonaws.com/resources/environments/logs/someHeaders"
}
Github 代理認為該數字(https://elasticbeanstalk-us-east-2-123456789 )是秘密并將其隱藏(https://elasticbeanstalk-us-east-2-*******),但我們在 Github 設定中沒有這樣的秘密。我們如何才能看到完整的 URL?
uj5u.com熱心網友回復:
由于您的 AWS 賬戶 ID 設定為機密,因此 GitHub 將在操作日志中的任何位置自動編輯該文本字串。更多資訊,以及繞過它的一些方法,可以在這里找到。
編輯:
默認情況下,該操作aws-actions/configure-aws-credentials會屏蔽帳戶 ID。您可以通過將引數傳遞mask-aws-account-id: false給操作來取消屏蔽它。這是架構相關部分的鏈接。
uj5u.com熱心網友回復:
感謝@mpriscella
答案是:aws configure credentials 自動隱藏您的帳戶 ID(可能還有其他)。
有辦法顯示它 - 添加引數mask-aws-account-id: no(或作為 mansioned @mpriscella false而不是 no):
steps:
- name: Configure my AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id : ${{ secrets.MY_AWS_ACCES_KEY }}
aws-secret-access-key: ${{ secrets.MY_AWS_SECRET_KEY }}
aws-region : ${{ env.AWS_REGION_NAME }}
mask-aws-account-id : no
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/468089.html
