Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 27, 2025

Adds a reusable dcx variable for docker compose exec with HTTP proxy environment variables, eliminating the need to repeat this verbose command pattern:

$dc exec -e "HTTP_PROXY=${HTTP_PROXY:-}" -e "HTTPS_PROXY=${HTTPS_PROXY:-}" -e "NO_PROXY=${NO_PROXY:-}" -e "http_proxy=${http_proxy:-}" -e "https_proxy=${https_proxy:-}" -e "no_proxy=${no_proxy:-}"

Changes:

  • Added exec_proxy_args variable in install/dc-detect-version.sh to define the -e flags for proxy environment variables (following the same DRY pattern as proxy_args)
  • Added dcx variable alongside existing dc, dcr, dcb shortcuts that uses $exec_proxy_args
  • Updated install/bootstrap-s3-nodestore.sh to use $dcx
  • Updated install/bootstrap-s3-profiles.sh to use $dcx

Usage:

# Before
$dc exec -e "HTTP_PROXY=${HTTP_PROXY:-}" ... seaweedfs apk add --no-cache s3cmd

# After
$dcx seaweedfs apk add --no-cache s3cmd

Refs #4060 (comment)

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Original prompt

This section details on the original issue you should resolve

<issue_title>Create a bash shortcut for docker compose exec with http proxy</issue_title>
<issue_description>Feel free to pick up this issue, since it's easy.


@aldy505 we should have a shortcut for this monstrosity:

$dc exec -e "HTTP_PROXY=${HTTP_PROXY:-}" -e "HTTPS_PROXY=${HTTPS_PROXY:-}" -e "NO_PROXY=${NO_PROXY:-}" -e "http_proxy=${http_proxy:-}" -e "https_proxy=${https_proxy:-}" -e "no_proxy=${no_proxy:-}" 

Originally posted by @BYK in #4060 (comment)
</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add bash shortcut for docker compose exec with http proxy Add dcep shortcut for docker compose exec with HTTP proxy env vars Nov 27, 2025
Copilot finished work on behalf of BYK November 27, 2025 19:45
Copilot AI requested a review from BYK November 27, 2025 19:45

proxy_args="--build-arg HTTP_PROXY=${HTTP_PROXY:-} --build-arg HTTPS_PROXY=${HTTPS_PROXY:-} --build-arg NO_PROXY=${NO_PROXY:-} --build-arg http_proxy=${http_proxy:-} --build-arg https_proxy=${https_proxy:-} --build-arg no_proxy=${no_proxy:-}"
# Shortcut for docker compose exec with http proxy environment variables
dcep="$dc exec -e \"HTTP_PROXY=${HTTP_PROXY:-}\" -e \"HTTPS_PROXY=${HTTPS_PROXY:-}\" -e \"NO_PROXY=${NO_PROXY:-}\" -e \"http_proxy=${http_proxy:-}\" -e \"https_proxy=${https_proxy:-}\" -e \"no_proxy=${no_proxy:-}\""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dcep="$dc exec -e \"HTTP_PROXY=${HTTP_PROXY:-}\" -e \"HTTPS_PROXY=${HTTPS_PROXY:-}\" -e \"NO_PROXY=${NO_PROXY:-}\" -e \"http_proxy=${http_proxy:-}\" -e \"https_proxy=${https_proxy:-}\" -e \"no_proxy=${no_proxy:-}\""
dcx="$dc exec -e \"HTTP_PROXY=${HTTP_PROXY:-}\" -e \"HTTPS_PROXY=${HTTPS_PROXY:-}\" -e \"NO_PROXY=${NO_PROXY:-}\" -e \"http_proxy=${http_proxy:-}\" -e \"https_proxy=${https_proxy:-}\" -e \"no_proxy=${no_proxy:-}\""

Let's rename this to dcx (short for docker compose exec) and find all relevant occurances in the codebase and replace them with dcx (not just in install/bootstrap-s3-nodestore.sh)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to dcx in commit 5375e5b. I've searched the codebase and the only occurrence of the proxy pattern in exec was in bootstrap-s3-nodestore.sh, which is now updated to use $dcx.

Copilot AI changed the title Add dcep shortcut for docker compose exec with HTTP proxy env vars Add dcx shortcut for docker compose exec with HTTP proxy env vars Nov 27, 2025
Copilot AI requested a review from BYK November 27, 2025 19:50
Copilot finished work on behalf of BYK November 27, 2025 19:50
@aldy505
Copy link
Collaborator

aldy505 commented Nov 28, 2025

Copilot stating the legal boilerplate is wild.

Copilot AI requested a review from BYK November 28, 2025 07:14
Copilot finished work on behalf of BYK November 28, 2025 07:14
Copilot AI requested a review from BYK November 28, 2025 07:23
Copilot finished work on behalf of BYK November 28, 2025 07:23
fi
dcb="$dc build $proxy_args"
dbuild="$CONTAINER_ENGINE build $proxy_args"
dcx="$dc exec -e HTTP_PROXY=${HTTP_PROXY:-} -e HTTPS_PROXY=${HTTPS_PROXY:-} -e NO_PROXY=${NO_PROXY:-} -e http_proxy=${http_proxy:-} -e https_proxy=${https_proxy:-} -e no_proxy=${no_proxy:-}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use $proxy_args_dc defined above for the proxy arguments. Do not write them yourself. See the example on line 61

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added exec_proxy_args variable (similar to proxy_args) and updated dcx to use $exec_proxy_args instead of inline proxy flags. This follows the same DRY pattern as proxy_args/proxy_args_dc. Commit 49ca442.

Copilot finished work on behalf of BYK November 28, 2025 07:29
Copilot AI requested a review from BYK November 28, 2025 07:29
@BYK BYK marked this pull request as ready for review November 28, 2025 07:29
@BYK
Copy link
Member

BYK commented Nov 28, 2025

@aldy505 I think this is good enough

@aldy505
Copy link
Collaborator

aldy505 commented Nov 28, 2025

@copilot You may rebase from master, you have conflicts

Copy link
Contributor Author

Copilot AI commented Nov 28, 2025

@copilot You may rebase from master, you have conflicts

I'm unable to rebase or resolve merge conflicts directly as I don't have access to force push. Could you please rebase this branch from master to resolve the conflicts?

Copilot AI requested a review from aldy505 November 28, 2025 07:33
Copilot finished work on behalf of aldy505 November 28, 2025 07:33
@aldy505
Copy link
Collaborator

aldy505 commented Nov 28, 2025

@copilot You need to use the $dcx shortcut on the install/bootstrap-s3-profiles.sh file too!

Copy link
Contributor Author

Copilot AI commented Nov 28, 2025

@copilot You need to use the $dcx shortcut on the install/bootstrap-s3-profiles.sh file too!

Updated install/bootstrap-s3-profiles.sh to use $dcx in both places where the verbose proxy pattern was used. Commit dc1a28f.

Copilot finished work on behalf of aldy505 November 28, 2025 07:45
Copy link
Collaborator

@aldy505 aldy505 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough

@BYK BYK enabled auto-merge (squash) November 28, 2025 09:21
@BYK BYK merged commit c9aa626 into master Nov 28, 2025
15 checks passed
@BYK BYK deleted the copilot/create-bash-shortcut-docker branch November 28, 2025 09:48
@aldy505 aldy505 mentioned this pull request Nov 28, 2025
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Create a bash shortcut for docker compose exec with http proxy

3 participants