Skip to content

WEEK-4:Rename jobs in the workflow #4

WEEK-4:Rename jobs in the workflow

WEEK-4:Rename jobs in the workflow #4

Workflow file for this run

name: Go App CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
Run-Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23' # Make sure this matches your go.mod file
- name: run tests
run: go test -v ./...
Build-Push:
needs: Run Tests

Check failure on line 25 in .github/workflows/ci-cd.yaml

View workflow run for this annotation

GitHub Actions / Go App CI/CD

Invalid workflow file

The workflow is not valid. .github/workflows/ci-cd.yaml (Line: 25, Col: 12): Job 'Build-Push' depends on unknown job 'Run Tests'. .github/workflows/ci-cd.yaml (Line: 60, Col: 12): Job 'DEV-Deploy' depends on job 'Build-Push' which creates a cycle in the dependency graph.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build Docker image
run: |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/devops-journey:latest .
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/devops-journey:latest
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.12.0 # Specify the Helm version you want to use
- name: Package Helm chart
run: |
helm package ./helm-chart
- name: Upload Helm chart as artifact
uses: actions/upload-artifact@v4
with:
name: helm-chart
path: devops-journey-0.1.0.tgz
DEV-Deploy:
needs: Build-Push
runs-on: self-hosted # deploying to local k8s cluster
steps:
- name: Download Helm chart
uses: actions/download-artifact@v4
with:
name: helm-chart
path: chart/
- name: deploy-to-dev
run: |
helm upgrade --install devops-journey chart/devops-journey-0.1.0.tgz -n dev
echo "Deployed to dev successfully!!"
QA-Deploy:
needs: DEV-Deploy
runs-on: self-hosted # deploying to local k8s cluster
steps:
- name: Download Helm chart
uses: actions/download-artifact@v4
with:
name: helm-chart
path: chart/
- name: deploy-to-qa
run: |
helm upgrade --install devops-journey chart/devops-journey-0.1.0.tgz -n qa
echo "Deployed to QA successfully!!"
Prod-Deploy:
needs: QA-Deploy
runs-on: self-hosted # deploying to local k8s cluster
steps:
- name: Download Helm chart
uses: actions/download-artifact@v4
with:
name: helm-chart
path: chart/
- name: deploy-to-prod
run: |
helm upgrade --install devops-journey chart/devops-journey-0.1.0.tgz -n prod
echo "Deployed to Prod successfully!!"