diff --git a/.codebuild/buildspec.yml b/.codebuild/buildspec.yml index 6eaf3868..ec8e2ba1 100644 --- a/.codebuild/buildspec.yml +++ b/.codebuild/buildspec.yml @@ -4,6 +4,7 @@ phases: install: commands: - chmod +x -R scripts + - ./scripts/install_deps.sh - ./scripts/hack/codepipeline-git-commit.sh - ./scripts/hack/symlink-gopath-codebuild.sh - cd /go/src/github.com/awslabs/amazon-ecr-credential-helper diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1d948569..cd23a192 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,11 +28,19 @@ jobs: cross-compile: runs-on: 'ubuntu-22.04' - container: public.ecr.aws/docker/library/golang:1.19 + container: public.ecr.aws/docker/library/golang:1.21-alpine steps: + # Need to update git before checking out the repository. + # This is a workaround for https://github.com/actions/checkout/issues/335 + # where older git versions would not create the .git folder for the repository. + - name: Update Git + run: apk add --no-cache git - uses: actions/checkout@v4 with: path: src/github.com/awslabs/amazon-ecr-credential-helper + - name: Install dependencies to container + run: ./scripts/install_deps.sh + working-directory: src/github.com/awslabs/amazon-ecr-credential-helper - name: Cross-compile all variants run: make all-variants working-directory: src/github.com/awslabs/amazon-ecr-credential-helper diff --git a/scripts/install_deps.sh b/scripts/install_deps.sh new file mode 100755 index 00000000..634b6509 --- /dev/null +++ b/scripts/install_deps.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). You +# may not use this file except in compliance with the License. A copy of +# the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "license" file accompanying this file. This file is +# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF +# ANY KIND, either express or implied. See the License for the specific +# language governing permissions and limitations under the License. + +# A POSIX shell script which installs the required dependencies +# to build the Amazon ECR credential helper variants in a Golang +# Alpine container. + +set -ex + +apk add --no-cache \ + bash \ + git \ + make \ No newline at end of file