Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags not being passed to fargate tasks/containers #2697

Closed
MIJOTHY-V2 opened this issue May 3, 2024 · 1 comment
Closed

Tags not being passed to fargate tasks/containers #2697

MIJOTHY-V2 opened this issue May 3, 2024 · 1 comment

Comments

@MIJOTHY-V2
Copy link
Contributor

Version info:

# action version
artilleryio/action-cli@v1 (`a7d844f999d5f3603f104db9cafb981d74f02940`)
# pulled image by action
artilleryio/artillery:latest (`sha256:e084b9aae46a8aca4ed50aaa2750ca2a72a51672b7fbd3544896da0ceeadbc6e`)

Running this command:

# on GHA
run-fargate ... --tags env:dev,service:artilleryio,target_stack:my-app

I expected to see this happen:

  1. To see the run-fargate job logs output the tags
  2. The fargate task and downstream resources to be tagged with the respective tags

Instead, this happened:

  1. The job logs did emit the tags, but
  2. The fargate task and downstream resources were not tagged

image

Additional Context

These tasks are running on a pre-existing untagged cluster, but the lack of tags there is fine for us, as we mainly want to distinguish between different artillery test runs on the same cluster using tags.

Thoughts

A very brief look at some of the source seems to point to context.tags being correctly picked up by artillery, hence the job logs emitting the relevant tags

if (context.tags.length > 0) {
logProgress(
'Tags: ' + context.tags.map((t) => t.name + ':' + t.value).join(', ')
);

but not being passed to the created AWS resources here

const ecs = new AWS.ECS({ apiVersion: '2014-11-13', region: context.region });
const leaderParams = Object.assign(
{ count: 1 },
JSON.parse(JSON.stringify(context.defaultECSParams))
);
leaderParams.overrides.containerOverrides[0].environment.push({
name: 'IS_LEADER',
value: 'true'
});
try {
const runData = await ecs.runTask(leaderParams).promise();

or here

const ecs = new AWS.ECS({ apiVersion: '2014-11-13', region: context.region });
let tasksRemaining = context.count - 1;
let retries = 0;
while (
tasksRemaining > 0 &&
context.status !== TEST_RUN_STATUS.TERMINATING &&
context.status !== TEST_RUN_STATUS.EARLY_STOP
) {
if (retries >= 10) {
artillery.log('Max retries for ECS (10) exceeded');
throw new Error('Max retries exceeded');
}
let launchCount = tasksRemaining <= 10 ? tasksRemaining : 10;
let params = Object.assign(
{ count: launchCount },
JSON.parse(JSON.stringify(context.defaultECSParams))
);
params.overrides.containerOverrides[0].environment.push({
name: 'IS_LEADER',
value: 'false'
});
try {
const runData = await ecs.runTask(params).promise();

@hassy
Copy link
Member

hassy commented May 3, 2024

The --tags flag is not for tagging AWS resources. It's only used by Artillery Cloud (for searching/organizing test runs)

Converting to discussion. Tagging AWS resources is a valid use-case but the flag is working as intended right now.

@artilleryio artilleryio locked and limited conversation to collaborators May 3, 2024
@hassy hassy converted this issue into discussion #2698 May 3, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants