Skip to content

Commit

Permalink
fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
tinnywang authored and Yiyuanzzz committed Jan 23, 2025
1 parent c5bf057 commit 447b0eb
Show file tree
Hide file tree
Showing 491 changed files with 46,398 additions and 13,982 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gitsecrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Git Secrets Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src/github.com/aws/amazon-ecs-agent
- name: Git Secrets Scan Script
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gomod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
path: src/github.com/aws/amazon-ecs-agent
Expand All @@ -26,7 +26,7 @@ jobs:
exit 1
fi
echo "GO_VERSION=$go_version" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.get-go-version.outputs.GO_VERSION }}
- name: Run go mod tidy and go mod vendor in csidriver module
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Linux unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
path: src/github.com/aws/amazon-ecs-agent
Expand All @@ -26,7 +26,7 @@ jobs:
exit 1
fi
echo "GO_VERSION=$go_version" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.get-go-version.outputs.GO_VERSION }}
- name: make test
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Static Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src/github.com/aws/amazon-ecs-agent
- name: get GO_VERSION
Expand All @@ -24,10 +24,10 @@ jobs:
exit 1
fi
echo "GO_VERSION=$go_version" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.get-go-version.outputs.GO_VERSION }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src/github.com/aws/amazon-ecs-agent
- name: run static checks
Expand All @@ -43,7 +43,7 @@ jobs:
name: Static Analysis Init
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src/github.com/aws/amazon-ecs-agent
- name: get GO_VERSION
Expand All @@ -59,10 +59,10 @@ jobs:
exit 1
fi
echo "GO_VERSION=$go_version" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.get-go-version.outputs.GO_VERSION }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src/github.com/aws/amazon-ecs-agent
- name: run static checks
Expand All @@ -78,7 +78,7 @@ jobs:
name: Cross platform build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src/github.com/aws/amazon-ecs-agent
- name: get GO_VERSION
Expand All @@ -94,10 +94,10 @@ jobs:
exit 1
fi
echo "GO_VERSION=$go_version" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.get-go-version.outputs.GO_VERSION }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
path: src/github.com/aws/amazon-ecs-agent
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Windows unit tests
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: src/github.com/aws/amazon-ecs-agent
- name: get GO_VERSION
Expand All @@ -24,10 +24,10 @@ jobs:
exit 1
}
Write-Output "GO_VERSION_WINDOWS=$go_version_win" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.get-go-version.outputs.GO_VERSION_WINDOWS }}
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
path: src/github.com/aws/amazon-ecs-agent
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

# 1.89.3
* Enhancement - Migrate ec2 package to aws-sdk-go-v2 [#4446](https://github.com/aws/amazon-ecs-agent/pull/4446)
* Enhancement - Handle specific exception codes on RCI call [#4457](https://github.com/aws/amazon-ecs-agent/pull/4457)
* Enhancement - Rename duplicate time field to be more descriptive and unique [#4465](https://github.com/aws/amazon-ecs-agent/pull/4465)

# 1.89.2
* Enhancement - Refactors Branch ENI configuration to support all platform types [#4436](https://github.com/aws/amazon-ecs-agent/pull/4436)
* Enhancement - Update agent version of https://github.com/containerd/cgroups from v3.0.2 to v3.0.4 [#4350](https://github.com/aws/amazon-ecs-agent/pull/4350)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.89.2
1.89.3
6 changes: 3 additions & 3 deletions agent/api/task/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -3006,9 +3006,9 @@ func (task *Task) RecordExecutionStoppedAt(container *apicontainer.Container) {
return
}
logger.Info("Essential container stopped; recording task stopped time", logger.Fields{
field.TaskID: task.GetID(),
field.Container: container.Name,
field.Time: now.String(),
field.TaskID: task.GetID(),
field.Container: container.Name,
field.ExecutionStoppedAt: now.String(),
})
}

Expand Down
43 changes: 33 additions & 10 deletions agent/app/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,15 @@ func (agent *ecsAgent) doStart(containerChangeEventStream *eventstream.EventStre
// Register the container instance
err = agent.registerContainerInstance(client, vpcSubnetAttributes)
if err != nil {
if isTransient(err) {
return exitcodes.ExitError
if isTerminal(err) {
// On unrecoverable error codes, agent should terminally exit.
logger.Critical("Agent will terminally exit, unable to register container instance:", logger.Fields{
field.Error: err,
})
return exitcodes.ExitTerminal
}
return exitcodes.ExitTerminal
// Other errors are considered recoverable and will be retried.
return exitcodes.ExitError
}

// Load Managed Daemon images asynchronously
Expand Down Expand Up @@ -855,13 +860,19 @@ func (agent *ecsAgent) registerContainerInstance(
field.Error: err,
})
if retriable, ok := err.(apierrors.Retriable); ok && !retriable.Retry() {
return err
return terminalError{err}
}
if utils.IsAWSErrorCodeEqual(err, apierrors.ErrCodeInvalidParameterException) {
logger.Critical("Instance registration attempt with an invalid parameter", logger.Fields{
field.Error: err,
})
return err
return terminalError{err}
}
if utils.IsAWSErrorCodeEqual(err, apierrors.ErrCodeClientException) {
logger.Critical("Instance registration attempt with client performing invalid action", logger.Fields{
field.Error: err,
})
return terminalError{err}
}
if _, ok := err.(apierrors.AttributeError); ok {
attributeErrorMsg := ""
Expand All @@ -871,9 +882,9 @@ func (agent *ecsAgent) registerContainerInstance(
logger.Critical("Instance registration attempt with invalid attribute(s)", logger.Fields{
field.Error: attributeErrorMsg,
})
return err
return terminalError{err}
}
return transientError{err}
return err
}
logger.Info("Instance registration completed successfully", logger.Fields{
"instanceArn": containerInstanceArn,
Expand Down Expand Up @@ -903,7 +914,19 @@ func (agent *ecsAgent) reregisterContainerInstance(client ecs.ECSClient, capabil
})
if apierrors.IsInstanceTypeChangedError(err) {
seelog.Criticalf(instanceTypeMismatchErrorFormat, err)
return err
return terminalError{err}
}
if utils.IsAWSErrorCodeEqual(err, apierrors.ErrCodeInvalidParameterException) {
logger.Critical("Instance re-registration attempt with an invalid parameter", logger.Fields{
field.Error: err,
})
return terminalError{err}
}
if utils.IsAWSErrorCodeEqual(err, apierrors.ErrCodeClientException) {
logger.Critical("Instance re-registration attempt with client performing invalid action", logger.Fields{
field.Error: err,
})
return terminalError{err}
}
if _, ok := err.(apierrors.AttributeError); ok {
attributeErrorMsg := ""
Expand All @@ -913,9 +936,9 @@ func (agent *ecsAgent) reregisterContainerInstance(client ecs.ECSClient, capabil
logger.Critical("Instance re-registration attempt with invalid attribute(s)", logger.Fields{
field.Error: attributeErrorMsg,
})
return err
return terminalError{err}
}
return transientError{err}
return err
}

// startAsyncRoutines starts all background methods
Expand Down
Loading

0 comments on commit 447b0eb

Please sign in to comment.