CI/CD con GitLab y Jenkins

Guía práctica para CI/CD con GitLab y Jenkins en Ubuntu 24.04, seguridad y automatización, con servicios de Q2BSTUDIO en IA, ciberseguridad y soluciones cloud.

28 sept 2025 • 3 min read • Q2BSTUDIO Team

Inteligencia-Artificial-

Introducción: En este artículo explicamos cómo implementar un flujo CI/CD con GitLab y Jenkins sobre Ubuntu 24.04, integrando buenas prácticas de seguridad y automatización para despliegues continuos. También presentamos a Q2BSTUDIO, empresa de desarrollo de software y aplicaciones a medida especializada en inteligencia artificial, ciberseguridad, servicios cloud aws y azure, servicios inteligencia de negocio y soluciones de automatización.

Paso 1 Actualizar Ubuntu 24.04 e instalar dependencias: antes de instalar Jenkins es recomendable actualizar paquetes e instalar Java 17 y herramientas necesarias. Comandos ejemplo en la terminal: sudo apt update; sudo apt install -y openjdk-17-jdk curl gnupg2 apt-transport-https software-properties-common. Jenkins 2.x y 3.x requieren Java 17 para un funcionamiento estable.

Paso 2 Añadir el repositorio de Jenkins y clave GPG: importar la clave y añadir el repositorio oficial para obtener paquetes actualizados. Comandos ejemplo: curl -fsSL https://pkg.jenkins.io/debian/jenkins.io-2023.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null; echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null. Esto permite que apt reconozca y verifique los paquetes de Jenkins.

Paso 3 Instalar Jenkins: ejecutar actualización de paquetes e instalar Jenkins desde el repositorio. Comandos: sudo apt update; sudo apt install -y jenkins.

Paso 4 Iniciar y habilitar el servicio: una vez instalado iniciar el servicio systemd y activarlo para que arranque al iniciar el servidor. Comandos: sudo systemctl start jenkins; sudo systemctl enable jenkins; sudo systemctl status jenkins. Por defecto Jenkins escucha en el puerto 8080 y la URL típica es https://jenkins-server-ip:8080

Paso 5 Desbloquear Jenkins: en la primera ejecución Jenkins pide la contraseña inicial que se encuentra en el sistema. Obtenerla con: sudo cat /var/lib/jenkins/secrets/initialAdminPassword. Con esa clave se accede al asistente de configuración web.

Paso 6 Instalar plugins recomendados y crear usuario admin: desde la interfaz web es aconsejable elegir instalar plugins recomendados y crear un usuario administrador. Plugins útiles para integración con GitLab incluyen GitLab Plugin, SSH Agent Plugin, GitLab API Plugin y GitLab Hook Plugin. Tras instalar plugins reiniciar Jenkins si se solicita.

Configuración SSH para despliegues sin contraseña: para que Jenkins pueda desplegar en servidores remotos configure autenticación por clave SSH sin contraseña. Generar clave en el nodo Jenkins con: ssh-keygen -t rsa -b 4096 -C jenkins@jenkins-server y copiar la clave pública al servidor de aplicación con: ssh-copy-id user@application-server-ip. Verificar acceso: ssh user@application-server-ip ls -la.

Integración con GitLab y pipelines: cree proyectos en GitLab y utilice webhooks o el plugin de GitLab en Jenkins para lanzar jobs al push o merge request. Un pipeline típico en GitLab CI puede ejecutar pruebas, construir artefactos y notificar a Jenkins o ser orquestado por Jenkinsfile. Mantenga secretos en credenciales seguras y utilice nodos o agentes para cargar builds aislados.

Buenas prácticas de seguridad y operación: mantenga el servidor actualizado, limite acceso al puerto 8080 mediante firewall, habilite HTTPS con un proxy inverso y gestione credenciales con el almacén de Jenkins. Para entornos de producción considere hardening, backups periódicos del directorio JENKINS_HOME y monitorización.

Automatización y servicios profesionales: en Q2BSTUDIO ayudamos a diseñar y desplegar pipelines CI/CD robustos, integrando testing automático, despliegues en la nube y soluciones de orquestación. Ofrecemos servicios de automatización de procesos y desarrollo de aplicaciones a medida que incorporan inteligencia artificial, agentes IA y capacidades de inteligencia de negocio como power bi para empresas.

Servicios complementarios y posicionamiento: además de CI/CD proporcionamos consultoría en ciberseguridad y pentesting para proteger la cadena de entrega, servicios cloud aws y azure para escalabilidad y coste eficiente, y soluciones de inteligencia de negocio y servicios inteligencia de negocio que mejoran la toma de decisiones. Si su organización necesita ia para empresas o agentes IA integrados en procesos de despliegue y operación podemos asesorarle y ejecutar la implantación.

Resumen: implementar CI/CD con GitLab y Jenkins en Ubuntu implica preparar el sistema, añadir el repositorio de Jenkins, instalar y configurar el servicio, asegurar el acceso mediante claves SSH y configurar pipelines que automaticen pruebas y despliegues. Contacte con Q2BSTUDIO para proyectos de software a medida, integración continua, ciberseguridad y servicios cloud para llevar su plataforma al siguiente nivel.

A BREAK?

Play for a moment before you go

OUR SERVICES

How we can help you

Artificial intelligence

AI agents, chatbots, and intelligent assistants that automate tasks and serve your customers 24/7 to improve the efficiency of your business.

More info

Software Development

Web, mobile, and desktop applications, intranets, e-commerce, SaaS, and management platforms designed for your company's specific needs.

More info

Cloud services

Migration, infrastructure, managed hosting, high availability, and security on Microsoft Azure and Amazon Web Services to help your business scale without limits.

More info

Cybersecurity and pentesting

Security audits, penetration testing and protection of applications, data and infrastructure on-premise and cloud, with ethical hacking and regulatory compliance.

More info

Business Intelligence

Dashboards and data analysis with Power BI: we integrate your sources, design dashboards and KPIs and turn your data into decisions.

More info

Process automation

We automate repetitive tasks and connect your applications with n8n, Power Automate, Make, and RPA, eliminating manual work and increasing productivity.

More info

Training for Companies

We train your teams in technology with criteria: web development, databases, Git, best practices and security, automation with n8n, artificial intelligence for companies and creation of AI solutions with Azure AI Foundry.

More info

Code Auditing

We audit the code that you, your team or an AI create: we tell you what is good and what to improve, we secure it and make it ready for production, web or app.

More info

AI Image Generation

We create for you the images that your business needs with artificial intelligence: product, networks, advertising, illustration and avatars. You tell us what you want and we deliver it ready to use.

More info

AI Video Generation

We create videos with artificial intelligence for you: promotional, networking, virtual presenters, dubbing and animations. You tell us the idea and we will deliver it assembled and ready to publish.

More info

AI Conversational Avatars

We create conversational avatars with AI – digital humans with a face and voice – that serve your customers and teams with the knowledge of your company, on your website, interactive monitors, WhatsApp or Teams.

More info

Online Marketing and AI

Google Ads, Meta Ads, LinkedIn Ads and AI Engine Positioning (GEO/AEO): we attract customers and make your brand appear where they search for you, also on ChatGPT, Gemini and Perplexity.

More info

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.

Live Chat