Skip to content

Commit bd4ecb1

Browse files
sparrcyinyic
authored andcommitted
Bump Go version to 1.19.1 (#3398)
* Bump Go version to 1.19.1 pickup the fix for https://nvd.nist.gov/vuln/detail/CVE-2022-27664 * make goimports * make goimports -f init_Makefile * fix seelog xml * deprecate ioutil
1 parent 21a220e commit bd4ecb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1023
-1041
lines changed

GO_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.18.3
1+
1.19.1

GO_VERSION_WINDOWS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.18.3
1+
1.19.1

agent/api/container/container_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func TestIsInternal(t *testing.T) {
138138
}
139139

140140
// TestSetupExecutionRoleFlag tests whether or not the container appropriately
141-
//sets the flag for using execution roles
141+
// sets the flag for using execution roles
142142
func TestSetupExecutionRoleFlag(t *testing.T) {
143143
testCases := []struct {
144144
container *Container

agent/api/task/task_linux.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,12 @@ func buildCgroupV1Root(taskID string) string {
9898
// buildCgroupV2Root creates a root cgroup using the systemd driver's special "-"
9999
// character. The "-" specifies a parent slice, so tasks and their containers end up
100100
// looking like this in the cgroup directory:
101-
// /sys/fs/cgroup/ecstasks.slice/
102-
// ├── ecstasks-XXXXf406f70c4c678073ae96944fXXXX.slice
103-
// │ └── docker-XXXX7c6dc81f2e9a8bf1c566dc769733ccba594b3007dd289a0f50ad7923XXXX.scope
104-
// └── ecstasks-XXXX30467358463ab6bbba4e73afXXXX.slice
105-
// └── docker-XXXX7ef4e942552437c96051356859c1df169f16e1cf9a9fc96fd30614e6XXXX.scope
101+
//
102+
// /sys/fs/cgroup/ecstasks.slice/
103+
// ├── ecstasks-XXXXf406f70c4c678073ae96944fXXXX.slice
104+
// │ └── docker-XXXX7c6dc81f2e9a8bf1c566dc769733ccba594b3007dd289a0f50ad7923XXXX.scope
105+
// └── ecstasks-XXXX30467358463ab6bbba4e73afXXXX.slice
106+
// └── docker-XXXX7ef4e942552437c96051356859c1df169f16e1cf9a9fc96fd30614e6XXXX.scope
106107
func buildCgroupV2Root(taskID string) string {
107108
return fmt.Sprintf("%s-%s.slice", config.DefaultTaskCgroupV2Prefix, taskID)
108109
}

agent/app/agent_capability.go

+47-47
Original file line numberDiff line numberDiff line change
@@ -129,53 +129,53 @@ var (
129129
// capabilities returns the supported capabilities of this agent / docker-client pair.
130130
// Currently, the following capabilities are possible:
131131
//
132-
// com.amazonaws.ecs.capability.privileged-container
133-
// com.amazonaws.ecs.capability.docker-remote-api.1.17
134-
// com.amazonaws.ecs.capability.docker-remote-api.1.18
135-
// com.amazonaws.ecs.capability.docker-remote-api.1.19
136-
// com.amazonaws.ecs.capability.docker-remote-api.1.20
137-
// com.amazonaws.ecs.capability.logging-driver.json-file
138-
// com.amazonaws.ecs.capability.logging-driver.syslog
139-
// com.amazonaws.ecs.capability.logging-driver.fluentd
140-
// com.amazonaws.ecs.capability.logging-driver.journald
141-
// com.amazonaws.ecs.capability.logging-driver.gelf
142-
// com.amazonaws.ecs.capability.logging-driver.none
143-
// com.amazonaws.ecs.capability.selinux
144-
// com.amazonaws.ecs.capability.apparmor
145-
// com.amazonaws.ecs.capability.ecr-auth
146-
// com.amazonaws.ecs.capability.task-iam-role
147-
// com.amazonaws.ecs.capability.task-iam-role-network-host
148-
// ecs.capability.docker-volume-driver.${driverName}
149-
// ecs.capability.task-eni
150-
// ecs.capability.task-eni-block-instance-metadata
151-
// ecs.capability.execution-role-ecr-pull
152-
// ecs.capability.execution-role-awslogs
153-
// ecs.capability.container-health-check
154-
// ecs.capability.private-registry-authentication.secretsmanager
155-
// ecs.capability.secrets.ssm.environment-variables
156-
// ecs.capability.secrets.ssm.bootstrap.log-driver
157-
// ecs.capability.pid-ipc-namespace-sharing
158-
// ecs.capability.ecr-endpoint
159-
// ecs.capability.secrets.asm.environment-variables
160-
// ecs.capability.secrets.asm.bootstrap.log-driver
161-
// ecs.capability.aws-appmesh
162-
// ecs.capability.task-eia
163-
// ecs.capability.task-eni-trunking
164-
// ecs.capability.task-eia.optimized-cpu
165-
// ecs.capability.firelens.fluentd
166-
// ecs.capability.firelens.fluentbit
167-
// ecs.capability.efs
168-
// com.amazonaws.ecs.capability.logging-driver.awsfirelens
169-
// ecs.capability.logging-driver.awsfirelens.log-driver-buffer-limit
170-
// ecs.capability.firelens.options.config.file
171-
// ecs.capability.firelens.options.config.s3
172-
// ecs.capability.full-sync
173-
// ecs.capability.gmsa
174-
// ecs.capability.efsAuth
175-
// ecs.capability.env-files.s3
176-
// ecs.capability.fsxWindowsFileServer
177-
// ecs.capability.execute-command
178-
// ecs.capability.external
132+
// com.amazonaws.ecs.capability.privileged-container
133+
// com.amazonaws.ecs.capability.docker-remote-api.1.17
134+
// com.amazonaws.ecs.capability.docker-remote-api.1.18
135+
// com.amazonaws.ecs.capability.docker-remote-api.1.19
136+
// com.amazonaws.ecs.capability.docker-remote-api.1.20
137+
// com.amazonaws.ecs.capability.logging-driver.json-file
138+
// com.amazonaws.ecs.capability.logging-driver.syslog
139+
// com.amazonaws.ecs.capability.logging-driver.fluentd
140+
// com.amazonaws.ecs.capability.logging-driver.journald
141+
// com.amazonaws.ecs.capability.logging-driver.gelf
142+
// com.amazonaws.ecs.capability.logging-driver.none
143+
// com.amazonaws.ecs.capability.selinux
144+
// com.amazonaws.ecs.capability.apparmor
145+
// com.amazonaws.ecs.capability.ecr-auth
146+
// com.amazonaws.ecs.capability.task-iam-role
147+
// com.amazonaws.ecs.capability.task-iam-role-network-host
148+
// ecs.capability.docker-volume-driver.${driverName}
149+
// ecs.capability.task-eni
150+
// ecs.capability.task-eni-block-instance-metadata
151+
// ecs.capability.execution-role-ecr-pull
152+
// ecs.capability.execution-role-awslogs
153+
// ecs.capability.container-health-check
154+
// ecs.capability.private-registry-authentication.secretsmanager
155+
// ecs.capability.secrets.ssm.environment-variables
156+
// ecs.capability.secrets.ssm.bootstrap.log-driver
157+
// ecs.capability.pid-ipc-namespace-sharing
158+
// ecs.capability.ecr-endpoint
159+
// ecs.capability.secrets.asm.environment-variables
160+
// ecs.capability.secrets.asm.bootstrap.log-driver
161+
// ecs.capability.aws-appmesh
162+
// ecs.capability.task-eia
163+
// ecs.capability.task-eni-trunking
164+
// ecs.capability.task-eia.optimized-cpu
165+
// ecs.capability.firelens.fluentd
166+
// ecs.capability.firelens.fluentbit
167+
// ecs.capability.efs
168+
// com.amazonaws.ecs.capability.logging-driver.awsfirelens
169+
// ecs.capability.logging-driver.awsfirelens.log-driver-buffer-limit
170+
// ecs.capability.firelens.options.config.file
171+
// ecs.capability.firelens.options.config.s3
172+
// ecs.capability.full-sync
173+
// ecs.capability.gmsa
174+
// ecs.capability.efsAuth
175+
// ecs.capability.env-files.s3
176+
// ecs.capability.fsxWindowsFileServer
177+
// ecs.capability.execute-command
178+
// ecs.capability.external
179179
func (agent *ecsAgent) capabilities() ([]*ecs.Attribute, error) {
180180
var capabilities []*ecs.Attribute
181181

agent/app/data.go

+12-12
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,20 @@ type savedData struct {
4646
// load from boltdb, and if it doesn't get anything, it tries to load from state file and then save data it loaded to
4747
// boltdb. Behavior of three cases are considered:
4848
//
49-
// 1. Agent starts from fresh instance (no previous state):
50-
// (1) Try to load from boltdb, get nothing;
51-
// (2) Try to load from state file, get nothing;
52-
// (3) Return empty data.
49+
// 1. Agent starts from fresh instance (no previous state):
50+
// (1) Try to load from boltdb, get nothing;
51+
// (2) Try to load from state file, get nothing;
52+
// (3) Return empty data.
5353
//
54-
// 2. Agent starts with previous state stored in boltdb:
55-
// (1) Try to load from boltdb, get the data;
56-
// (2) Return loaded data.
54+
// 2. Agent starts with previous state stored in boltdb:
55+
// (1) Try to load from boltdb, get the data;
56+
// (2) Return loaded data.
5757
//
58-
// 3. Agent starts with previous state stored in state file (i.e. it was just upgraded from an old agent that uses state file):
59-
// (1) Try to load from boltdb, get nothing;
60-
// (2) Try to load from state file, get something;
61-
// (3) Save loaded data to boltdb;
62-
// (4) Return loaded data.
58+
// 3. Agent starts with previous state stored in state file (i.e. it was just upgraded from an old agent that uses state file):
59+
// (1) Try to load from boltdb, get nothing;
60+
// (2) Try to load from state file, get something;
61+
// (3) Save loaded data to boltdb;
62+
// (4) Return loaded data.
6363
func (agent *ecsAgent) loadData(containerChangeEventStream *eventstream.EventStream,
6464
credentialsManager credentials.Manager,
6565
state dockerstate.TaskEngineState,

agent/config/conditional.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type BooleanDefaultFalse struct {
7171
Value Conditional
7272
}
7373

74-
/// Enabled is a convenience function for when consumers don't care if the value is implicit or explicit
74+
// / Enabled is a convenience function for when consumers don't care if the value is implicit or explicit
7575
func (b BooleanDefaultFalse) Enabled() bool {
7676
return b.Value == ExplicitlyEnabled
7777
}

agent/config/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
Package config handles loading configuration data, warning on missing data,
1616
and setting sane defaults.
1717
18-
Configuration Sources
18+
# Configuration Sources
1919
2020
Configuration data is loaded from two sources currently: the environment and
2121
a json config file.

agent/credentials/instancecreds/instancecreds_linux.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ import (
2525
// GetCredentials returns the instance credentials chain. This is the default chain
2626
// credentials plus the "rotating shared credentials provider", so credentials will
2727
// be checked in this order:
28-
// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
29-
// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key).
30-
// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)).
31-
// 4. Rotating shared credentials file located at /rotatingcreds/credentials
28+
// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
29+
// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key).
30+
// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)).
31+
// 4. Rotating shared credentials file located at /rotatingcreds/credentials
3232
func GetCredentials(isExternal bool) *credentials.Credentials {
3333
mu.Lock()
3434
if credentialChain == nil {

agent/credentials/instancecreds/instancecreds_unsupported.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import (
2323
// GetCredentials returns the instance credentials chain. This is the default chain
2424
// credentials plus the "rotating shared credentials provider", so credentials will
2525
// be checked in this order:
26-
// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
27-
// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key).
28-
// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)).
29-
// 4. Rotating shared credentials file located at /rotatingcreds/credentials
26+
// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
27+
// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key).
28+
// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)).
29+
// 4. Rotating shared credentials file located at /rotatingcreds/credentials
3030
func GetCredentials(isExternal bool) *credentials.Credentials {
3131
return nil
3232
}

agent/credentials/instancecreds/instancecreds_windows.go

+17-13
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,25 @@ import (
2525
// GetCredentials returns the instance credentials chain. This is the default chain
2626
// credentials plus the "rotating shared credentials provider", so credentials will
2727
// be checked in this order:
28-
// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
29-
// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key).
30-
// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)).
31-
// 4. Rotating shared credentials file located at /rotatingcreds/credentials
3228
//
33-
// The default credential chain provided by the SDK includes:
34-
// * EnvProvider
35-
// * SharedCredentialsProvider
36-
// * RemoteCredProvider (EC2RoleProvider)
29+
// 1. Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
3730
//
38-
// In the case of ECS-A on Windows, the `SharedCredentialsProvider` takes
39-
// precedence over the `RotatingSharedCredentialsProvider` and this results
40-
// in the credentials not being refreshed. To mitigate this issue, we will
41-
// reorder the credential chain and ensure that `RotatingSharedCredentialsProvider`
42-
// takes precedence over the `SharedCredentialsProvider` for ECS-A.
31+
// 2. Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key).
32+
//
33+
// 3. EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)).
34+
//
35+
// 4. Rotating shared credentials file located at /rotatingcreds/credentials
36+
//
37+
// The default credential chain provided by the SDK includes:
38+
// * EnvProvider
39+
// * SharedCredentialsProvider
40+
// * RemoteCredProvider (EC2RoleProvider)
41+
//
42+
// In the case of ECS-A on Windows, the `SharedCredentialsProvider` takes
43+
// precedence over the `RotatingSharedCredentialsProvider` and this results
44+
// in the credentials not being refreshed. To mitigate this issue, we will
45+
// reorder the credential chain and ensure that `RotatingSharedCredentialsProvider`
46+
// takes precedence over the `SharedCredentialsProvider` for ECS-A.
4347
func GetCredentials(isExternal bool) *credentials.Credentials {
4448
mu.Lock()
4549
credProviders := defaults.CredProviders(defaults.Config(), defaults.Handlers())

agent/dockerclient/dockerapi/docker_client.go

+15-14
Original file line numberDiff line numberDiff line change
@@ -214,20 +214,21 @@ type DockerClient interface {
214214

215215
// DockerGoClient wraps the underlying go-dockerclient and docker/docker library.
216216
// It exists primarily for the following four purposes:
217-
// 1) Provide an abstraction over inputs and outputs,
218-
// a) Inputs: Trims them down to what we actually need (largely unchanged tbh)
219-
// b) Outputs: Unifies error handling and the common 'start->inspect'
220-
// pattern by having a consistent error output. This error output
221-
// contains error data with a given Name that aims to be presentable as a
222-
// 'reason' in state changes. It also filters out the information about a
223-
// container that is of interest, such as network bindings, while
224-
// ignoring the rest.
225-
// 2) Timeouts: It adds timeouts everywhere, mostly as a reaction to
226-
// pull-related issues in the Docker daemon.
227-
// 3) Versioning: It abstracts over multiple client versions to allow juggling
228-
// appropriately there.
229-
// 4) Allows for both the go-dockerclient client and Docker SDK client to live
230-
// side-by-side until migration to the Docker SDK is complete.
217+
// 1. Provide an abstraction over inputs and outputs,
218+
// a) Inputs: Trims them down to what we actually need (largely unchanged tbh)
219+
// b) Outputs: Unifies error handling and the common 'start->inspect'
220+
// pattern by having a consistent error output. This error output
221+
// contains error data with a given Name that aims to be presentable as a
222+
// 'reason' in state changes. It also filters out the information about a
223+
// container that is of interest, such as network bindings, while
224+
// ignoring the rest.
225+
// 2. Timeouts: It adds timeouts everywhere, mostly as a reaction to
226+
// pull-related issues in the Docker daemon.
227+
// 3. Versioning: It abstracts over multiple client versions to allow juggling
228+
// appropriately there.
229+
// 4. Allows for both the go-dockerclient client and Docker SDK client to live
230+
// side-by-side until migration to the Docker SDK is complete.
231+
//
231232
// Implements DockerClient
232233
// TODO Remove clientfactory field once all API calls are migrated to sdkclientFactory
233234
type dockerGoClient struct {

agent/dockerclient/dockerauth/doc.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
Package dockerauth handles storing auth configuration information for Docker
1616
registries.
1717
18-
Usage
18+
# Usage
1919
2020
This package pulls authentication information from the passed configuration.
2121
A user should set the "EngineAuthType" and "EngineAuthData" configuration
@@ -24,7 +24,7 @@ keys to values indicated below.
2424
These keys may be set by either setting the environment variables
2525
"ECS_ENGINE_AUTH_TYPE" and "ECS_ENGINE_AUTH_DATA" or by setting the keys "EngineAuthData" and "EngineAuthType" in the JSON configuration file located at the configured "ECS_AGENT_CONFIG_FILE_PATH" (see http://godoc.org/github.com/aws/amazon-ecs-agent/agent/config)
2626
27-
Auth Types
27+
# Auth Types
2828
2929
The two currently supported auth types are "docker" and "dockercfg".
3030
@@ -34,6 +34,7 @@ The auth type "docker" is intended to work most naturally with a JSON
3434
configuration file. The "AuthData" is a structured JSON object which specifies
3535
values for the docker "AuthConfig" structure. The "AuthData" should be an object
3636
similar to the following:
37+
3738
{
3839
"my.registry.example.com": {
3940
"username": "myUsername",
@@ -46,13 +47,13 @@ similar to the following:
4647
}
4748
}
4849
49-
5050
Dockercfg:
5151
5252
The auth type "dockercfg" is intended to allow easy use of an existing
5353
".dockercfg" file generated by running "docker login". This auth type expects
5454
the "AuthData" to be a string containing the contents of that file. The contents
5555
of your ".dockercfg" will generally be a string of the following form:
56+
5657
'{"http://myregistry.com/v1/":{"auth":"dXNlcjpzd29yZGZpc2g=","email":"email"}}'
5758
*/
5859
package dockerauth

agent/ecr/model/ecr/api.go

+8-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agent/ecr/model/ecr/service.go

+6-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)