MakeBuild - Make Failed: mkdir: /usr/local/aws-sam-cli/1.76.0/dist/libselinux.so.1: 没有可用的版本信息(mkdir 需要)

问题描述 投票:0回答:0

我正在尝试使用 sam build caommand 构建 sam 项目,但在 sam 构建阶段出现错误,没有可用的版本信息,需要一些关于如何传递 mkdir 版本信息的输入,以便构建阶段成功我已经尝试了各种解决方法,但它不是工作

这里是 make 文件

.PHONY: build-RuntimeDependenciesLayer build-lambda-common
.PHONY: build-getAllItemsFunction build-getByIdFunction build-putItemFunction

build-StoresFunction:
    $(MAKE) HANDLER=src/handlers/stores.ts build-lambda-common
build-loginFunction:
    $(MAKE) HANDLER=src/handlers/login.ts build-lambda-common
build-addStoreFunction:
    $(MAKE) HANDLER=src/handlers/add-store.ts build-lambda-common
build-updateStoreFunction:
    $(MAKE) HANDLER=src/handlers/update-store.ts build-lambda-common
build-bulkInsertStoresFunction:
    $(MAKE) HANDLER=src/handlers/bulk-insert-stores.ts build-lambda-common
build-sendEmailFunction:
    $(MAKE) HANDLER=src/handlers/send-email.ts build-lambda-common

build-lambda-common:
    npm install
    rm -rf dist
    echo "{\"extends\": \"./tsconfig.json\", \"include\": [\"${HANDLER}\"] }" > tsconfig-only-handler.json
    npm run build -- --build tsconfig-only-handler.json
    cp -r dist "$(ARTIFACTS_DIR)/"

build-RuntimeDependenciesLayer:
    mkdir -p "$(ARTIFACTS_DIR)/nodejs"
    cp package.json package-lock.json "$(ARTIFACTS_DIR)/nodejs/"
    npm install --production --prefix "$(ARTIFACTS_DIR)/nodejs/"
    rm "$(ARTIFACTS_DIR)/nodejs/package.json" # to avoid rebuilding when changes doesn't relate to dependencies

这里是github actions的pipeline代码

name: GitHub-Actions

on:
  push:
    branches:
      - main

env:
  AWS_REGION: ap-south-1
  LAMBDA_FUNCTION_NAME: Absolute
  ZIP_FILE_NAME: mycode.zip

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment:
      name: Production
    steps:
      - name: Checkout code
        uses: actions/checkout@v3

      
      - name: Install dependencies
        run: npm install --force

      - name: install make
        run: sudo apt-get install -y make
      
      - name: install mkdir
        run: sudo apt-get install --reinstall coreutils

      - name: Build function
        run: sam build

      - name: check build folder
        run: cd .aws-sam/build && ls -all

      - name: Install zip
        uses: montudor/action-zip@v1  

      - name: Zip output
        run: zip -rv mycode.zip . -i build/AddStoreFunction/* build/BulkInsertStoresFunction/* build/GetAllStoresFunction/* build/LoginFunction/* build/template.yaml 
        working-directory: .aws-sam
      
      - name: List Files
        run: cd .aws-sam && ls -all
      
      - name: Configure AWS credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: ${{ env.AWS_REGION }}

      - name: Update Lambda function code
        run: aws lambda update-function-code --function-name Absolute --no-cli-pager --publish --zip-file fileb://.aws-sam/mycode.zip
         
typescript lambda makefile github-actions cmake-gui
© www.soinside.com 2019 - 2024. All rights reserved.