Skip to content

build: bump mapstructure/v2 to v2.4.0 to fix CVEs #800

build: bump mapstructure/v2 to v2.4.0 to fix CVEs

build: bump mapstructure/v2 to v2.4.0 to fix CVEs #800

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
git-secrets:
runs-on: ubuntu-latest
steps:
- name: Pull latest awslabs/git-secrets repo
uses: actions/checkout@v4
with:
repository: awslabs/git-secrets
ref: 1.3.0
fetch-tags: true
path: git-secrets
- name: Install git secrets from source
run: sudo make install
working-directory: git-secrets
- uses: actions/checkout@v4
- name: Scan repository for git secrets
run: |
git secrets --register-aws
git secrets --scan-history
# It's recommended to run golangci-lint in a job separate from other jobs (go test, etc) because different jobs run in parallel.
go-linter:
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
# Pin the version in case all the builds start to fail at the same time.
# There may not be an automatic way (e.g., dependabot) to update a specific parameter of a GitHub Action,
# so we will just update it manually whenever it makes sense (e.g., a feature that we want is added).
version: v1.60.3
args: --build-tags e2e,unit --fix=false --timeout=5m --out-format=colored-line-number
unit-tests:
strategy:
fail-fast: false
matrix:
go: [ '1.23', '1.24' ]
os: [ ubuntu-latest, windows-latest ]
name: Unit Tests / ${{ matrix.os }} / Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false
- name: build
run: make build
- name: test-unit
run: make test-unit
e2e-tests-for-awslogs:
strategy:
fail-fast: false
matrix:
go: [ '1.23', '1.24' ]
os: [ ubuntu-latest ] # TODO: Add Windows e2e tests: https://github.com/aws/shim-loggers-for-containerd/issues/68
name: E2E tests / awslogs / ${{ matrix.os }} / Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false
- name: Start LocalStack
shell: bash
run: scripts/start-localstack
- name: install and start containerd
shell: bash
run: sudo scripts/install-containerd
- name: start ecs local endpoint
shell: bash
run: scripts/start-ecs-local-endpoint
- name: setup aws credentials for root user # need default creds when credential endpoint is not set
shell: bash
run: |
sudo mkdir -p /root/.aws
sudo aws configure set aws_access_key_id test --profile default
sudo aws configure set aws_secret_access_key test --profile default
sudo aws configure set region us-east-1 --profile default
- name: ip forwarding # awslogs driver hardcodes "169.254.170.2" as the aws credential endpoint ip so need to forward to local endpoint
shell: bash
run: sudo scripts/ip-forwarding
- name: build
run: sudo make build
- name: test-e2e
run: sudo -E make test-e2e-for-awslogs # containerd interaction requires sudo and aws cloudwatch interaction requires passing env vars
e2e-tests-for-fluentd:
strategy:
fail-fast: false
matrix:
go: [ '1.23', '1.24' ]
os: [ ubuntu-latest ] # TODO: Add Windows e2e tests: https://github.com/aws/shim-loggers-for-containerd/issues/68
name: E2E tests / fluentd / ${{ matrix.os }} / Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false
- name: install and start containerd
shell: bash
run: sudo scripts/install-containerd
- name: start fluentd local endpoint
shell: bash
run: scripts/start-fluentd-local-endpoint
- name: build
run: sudo make build
- name: test-e2e
run: sudo make test-e2e-for-fluentd # containerd interaction requires sudo
e2e-tests-for-splunk:
strategy:
fail-fast: false
matrix:
go: [ '1.23', '1.24' ]
os: [ ubuntu-latest ] # TODO: Add Windows e2e tests: https://github.com/aws/shim-loggers-for-containerd/issues/68
name: E2E tests / splunk / ${{ matrix.os }} / Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: false
- name: install and start containerd
shell: bash
run: sudo scripts/install-containerd
- name: start splunk local endpoint
id: splunk-local-endpoint
shell: bash
run: |
SPLUNK_PASSWORD=1234567Aa!
SPLUNK_PORT=8089
SPLUNK_IMAGE=splunk/splunk
CONTAINER_ID=$(docker run -d -p $SPLUNK_PORT:8089 -p 8088:8088 \
-e "SPLUNK_GENERAL_TERMS=--accept-sgt-current-at-splunk-com" \
-e "SPLUNK_START_ARGS=--accept-license" \
-e "SPLUNK_PASSWORD=$SPLUNK_PASSWORD" \
-e "SPLUNK_HEC_TOKEN=abcd1234" \
$SPLUNK_IMAGE)
echo "Splunk container ID: $CONTAINER_ID"
: # Splunk can only receives requests after becoming healthy
: # Wait up to 5 minutes for the container to become healthy
TIMEOUT=300
ELAPSED=0
INTERVAL=10
while [ $ELAPSED -lt $TIMEOUT ]; do
HEALTH_STATUS=$(docker inspect $CONTAINER_ID --format '{{.State.Health.Status}}')
echo "Health status after ${ELAPSED}s: $HEALTH_STATUS"
if [ "$HEALTH_STATUS" == "healthy" ]; then
echo "Splunk container is healthy"
break
fi
sleep $INTERVAL
ELAPSED=$((ELAPSED + INTERVAL))
done
: # Check if we timed out
if [ $ELAPSED -ge $TIMEOUT ]; then
echo "ERROR: Splunk container failed to become healthy within ${TIMEOUT} seconds"
echo "Container logs:"
docker logs $CONTAINER_ID
echo "Container inspect:"
docker inspect $CONTAINER_ID
exit 1
fi
curl -L -k -u admin:$SPLUNK_PASSWORD \
-X POST https://localhost:$SPLUNK_PORT/services/admin/token-auth/tokens_auth \
-d disabled=false
: # Wait for token to be enabled
sleep 5
TOKEN_OUTPUT=$(curl -L -k -u admin:$SPLUNK_PASSWORD \
-X POST https://localhost:$SPLUNK_PORT/services/authorization/tokens?output_mode=json \
-d name=admin -d audience=tests)
SPLUNK_TOKEN=$(echo $TOKEN_OUTPUT | jq -r '.entry[0].content.token')
echo "SPLUNK_TOKEN=$SPLUNK_TOKEN" >> $GITHUB_OUTPUT
- name: build
run: sudo make build
- name: test-e2e
run: |
sudo SPLUNK_TOKEN=${{ steps.splunk-local-endpoint.outputs.SPLUNK_TOKEN }} make test-e2e-for-splunk # containerd interaction requires sudo
go-mod-tidy-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
# TODO: Use `go mod tidy --check` after https://github.com/golang/go/issues/27005 is fixed.
- run: go mod tidy
- run: git diff --exit-code
mdlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: avto-dev/markdown-lint@v1
with:
args: '**/*.md'