Skip to content

[FEAT] Integrate argocd with gitlab in k3d cluster - #6

Open
LeaYeh wants to merge 22 commits into
mainfrom
lea/bonus
Open

[FEAT] Integrate argocd with gitlab in k3d cluster#6
LeaYeh wants to merge 22 commits into
mainfrom
lea/bonus

Conversation

@LeaYeh

@LeaYeh LeaYeh commented Oct 29, 2025

Copy link
Copy Markdown
Contributor

The gitlab is been installed in the k3d cluster as the requirements.
To launch it the flow are:

make up # install gitlab in the cluster and install argocd
make pf # port-forwarding for ssh and http serives
mae setup # set up gitlab PAT and use the same ssh-key for connecting gitlab and argocd 
image image

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR significantly expands the infrastructure setup capabilities by adding comprehensive tooling for multi-architecture support and GitLab integration. The changes transform a simple Vagrant installer into a flexible, production-ready DevOps toolkit.

  • Enhanced setup_host.sh to support both Vagrant (Part 1/2) and Kubernetes stack (Part 3), with ARM64 architecture support
  • Added Part 3 implementation with Argo CD bootstrap scripts and Kubernetes manifests
  • Introduced bonus section with full GitLab installation, account setup, and Argo CD integration for SSH-based GitOps workflows

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
scripts/setup_host.sh Complete rewrite: modular architecture detection, multi-arch VM provider support (VirtualBox/libvirt), Docker/kubectl/k3d installation with configurable options
p3/tools/bootstrap_argocd.sh New Argo CD bootstrapping script with k3d cluster creation, ServiceLB waiting, and application deployment
p3/Makefile New build automation for Part 3 with cluster lifecycle management
p3/manifests/* New Kubernetes manifests for playground app deployment via Argo CD
bonus/scripts/install_gitlab.sh New GitLab Helm installation with constrained resource mode, database migrations, and root user provisioning
bonus/scripts/setup_gitlab_account.sh New GitLab user creation and SSH key management via REST API
bonus/scripts/bootstrap_argocd.sh Extended Argo CD bootstrap with GitLab SSH integration and repo-creds setup
bonus/Makefile New comprehensive GitLab lifecycle management with port-forwarding, migrations, and cleanup targets
bonus/manifests/* New Kubernetes manifests and Kustomize configs for bonus deployment
bonus/confs/gitlab.constrained.yaml New GitLab Helm values for resource-constrained environments
.gitignore Added .gitlab.env to ignore list

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/setup_host.sh
log "Installing Docker (official script)..."
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker "$USER" || true
newgrp docker

Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

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

The newgrp docker command will start a new shell session and won't affect the current script execution flow. This is ineffective in a script context and should be removed. Users should be instructed to re-login or manually run newgrp docker after the script completes, similar to the warning at line 231.

Suggested change
newgrp docker
warn "You must re-login or run 'newgrp docker' for group changes to take effect."

Copilot uses AI. Check for mistakes.
Comment thread bonus/Makefile
@if [ -n "$${REPO_PAT:-}" ]; then \
echo "✅ REPO_PAT already set in environment, skipping creation."; \
exit 0; \
return 0; \

Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

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

Both exit 0 and return 0 are present, but return is not valid in a shell script executed by Make (only in functions). The return 0 line will never execute because exit 0 terminates the shell. Remove line 112.

Suggested change
return 0; \

Copilot uses AI. Check for mistakes.
Comment thread bonus/Makefile
Comment on lines +140 to +141
@unset GITLAB_ROOT_PASSWORD || true
@unset REPO_PAT || true

Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

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

The unset command has no effect in Make recipes because each recipe line runs in a separate shell. These lines don't actually unset the environment variables. If the intent is to document cleanup, convert these to comments. If the intent is to remove from .gitlab.env, use sed or similar to edit the file.

Suggested change
@unset GITLAB_ROOT_PASSWORD || true
@unset REPO_PAT || true
# If you need to clean up sensitive environment variables, do so in your shell.
# The unset command has no effect in Make recipes.

Copilot uses AI. Check for mistakes.
Comment thread scripts/setup_host.sh
}

install_virtualbox_amd64() {
log "installing VirtualBox (amd64) as Vagrant provider..."

Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

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

Corrected capitalization: 'installing' should be 'Installing' to match the capitalization style used in other log messages throughout the script (lines 100, 128, 157, etc.).

Suggested change
log "installing VirtualBox (amd64) as Vagrant provider..."
log "Installing VirtualBox (amd64) as Vagrant provider..."

Copilot uses AI. Check for mistakes.
Comment thread scripts/setup_host.sh
}

install_libvirt_arm64() {
log "installing libvirt + QEMU (arm64) as Vagrant provider..."

Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

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

Corrected capitalization: 'installing' should be 'Installing' to match the capitalization style used in other log messages throughout the script.

Suggested change
log "installing libvirt + QEMU (arm64) as Vagrant provider..."
log "Installing libvirt + QEMU (arm64) as Vagrant provider..."

Copilot uses AI. Check for mistakes.

local PASS="${GITLAB_ROOT_PASSWORD:-${GITLAB_ROOT_PASSWORD_FILE:-}}"
if [[ -z "$PASS" ]]; then
PASS='ChangeMe_+VeryStrong#2025'

Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

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

Hardcoded default password 'ChangeMe_+VeryStrong#2025' is a security concern. While intended as a temporary password, it's predictable and could be exploited if not changed. Consider generating a random password by default using openssl rand -base64 24 or similar, even when GITLAB_ROOT_PASSWORD is not set.

Suggested change
PASS='ChangeMe_+VeryStrong#2025'
need openssl
PASS="$(openssl rand -base64 24)"

Copilot uses AI. Check for mistakes.
Comment on lines +29 to +30
# TODO: Need to change the branch name to main later
REVISION="${REVISION:-lea/bonus}"

Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

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

TODO comment indicates temporary branch name 'lea/bonus'. This should be addressed before merging to production. Either update to the intended default branch (e.g., 'main') or create a tracking issue and reference it in the comment.

Suggested change
# TODO: Need to change the branch name to main later
REVISION="${REVISION:-lea/bonus}"
# Branch name set to 'main' for production use
REVISION="${REVISION:-main}"

Copilot uses AI. Check for mistakes.
Comment thread scripts/setup_host.sh
die() { echo -e "❌ $*" >&2; exit 1; }

DISTRO_CODENAME="$(lsb_release -cs 2>/dev/null || echo bookworm)"
ARCH_DEB="$(dpkg --print-architecture)"

Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

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

Trailing whitespace detected at end of line. Remove the trailing spaces for cleaner code.

Suggested change
ARCH_DEB="$(dpkg --print-architecture)"
ARCH_DEB="$(dpkg --print-architecture)"

Copilot uses AI. Check for mistakes.
Comment on lines +120 to +121


Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

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

Empty line with trailing whitespace. Remove the trailing spaces for cleaner code.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +217 to +218


Copilot AI Oct 29, 2025

Copy link

Choose a reason for hiding this comment

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

Empty line with trailing whitespace. Remove the trailing spaces for cleaner code.

Suggested change

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants