Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions .github/workflows/full-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Main workflow
on: [push, workflow_dispatch]
env: # Set the secret as an input
docker_username: ${{ github.actor }}
docker_username: ${{ github.actor }}
docker_password: ${{ secrets.GITHUB_TOKEN }} #Nees to be set to be made available to the workflow
APP_NAME: ${{ github.event.repository.name }}
BUILD_NUMBER: ${{ github.run_number }}
Expand All @@ -12,21 +12,21 @@ env: # Set the secret as an input
IMAGE: ${{ github.repository_owner }}/${{ github.event.repository.name }}
BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
COMMIT_URL: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}

jobs:
Build:
runs-on: ubuntu-latest
container: gradle:6-jdk11
steps:
- name: Clone down repository
uses: actions/checkout@v4
uses: actions/checkout@v4
- name: Build application
run: bash ci/build-app.sh
- name: Test
run: bash ci/unit-test-app.sh
- name: Upload repo
uses: actions/upload-artifact@v4
with:
with:
name: code
path: .
include-hidden-files: true
Expand All @@ -40,12 +40,12 @@ jobs:
name: code
path: .
- name: run linting
uses: super-linter/super-linter/slim@v7
uses: super-linter/super-linter/slim@v7
env:
DEFAULT_BRANCH: main
# To report GitHub Actions status checks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISABLE_ERRORS: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISABLE_ERRORS: true
Docker-image:
runs-on: ubuntu-latest
needs: [Build]
Expand Down Expand Up @@ -79,6 +79,12 @@ jobs:
with:
name: code
path: .
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
Expand Down Expand Up @@ -109,16 +115,22 @@ jobs:
name: code
path: .
- name: Execute performance test
run: bash ci/performance-test.sh
run: bash ci/performance-test.sh
Deploy:
runs-on: ubuntu-latest
needs: [Docker-image, Security-scan, Component-test, Performance-test]
steps:
- name: Download code
uses: actions/download-artifact@v4
with:
name: code
name: code
path: .
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to production
run: bash ci/start-application.sh
- name: stop production environment
Expand Down
1 change: 1 addition & 0 deletions ci/component-test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#! /bin/bash
[[ -z "${docker_username}" ]] && DockerRepo='' || DockerRepo="${docker_username}/"
echo "$docker_password" | docker login ghcr.io --username "$docker_username" --password-stdin
docker_username=$DockerRepo docker compose -f component-test/docker-compose.yml --project-directory . -p ci up --build --exit-code-from test
1 change: 1 addition & 0 deletions ci/performance-test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#! /bin/bash
[[ -z "${docker_username}" ]] && DockerRepo='' || DockerRepo="${docker_username}/"
echo "$docker_password" | docker login ghcr.io --username "$docker_username" --password-stdin
docker_username=$DockerRepo docker compose -f performance-test/docker-compose.yml --project-directory . -p ci up --build --exit-code-from test
13 changes: 8 additions & 5 deletions lab-01-get-ready.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Learning Goals

- Create a Kosli account
- Fork and set up the sample application repository
- Set up this repository on your GitHub account
- Verify that the CI/CD pipeline runs successfully
- Understand the basic structure of the application and its deployment process

Expand Down Expand Up @@ -40,7 +40,7 @@ In this lab, you will:

#### Create a Kosli account

- Navigate to [kosli.com/sign-up]<https://app.kosli.com/sign-up>)
- Navigate to [kosli.com/sign-up](<https://app.kosli.com/sign-up>)
- Choose to sign up with GitHub
- Complete the registration process
- Verify your email address if required
Expand All @@ -52,7 +52,10 @@ So far so good :tada:. We will go a lot more in detail with Kosli in the next se

- Navigate to the labs repositorys main page (the repository you're currently viewing)
- Click the "Use this template" button in the top-right corner of the page
- Select your personal GitHub account as the destination
- Select "Create a new repository"
- Select your personal GitHub account as the "Owner" and name the repository `labs`
- Optionally, add a description and choose to make the repository public or private
- Click "Create repository from template"
- Wait for GitHub to complete the copy process
- You should now have a copy at `https://github.com/YOUR-GITHUB-USERNAME/labs`

Expand Down Expand Up @@ -108,7 +111,7 @@ So far so good :tada:. We will go a lot more in detail with Kosli in the next se
#### View the Docker image

1. Go to your GitHub profile page
2. Click on "Packages" tab
2. Click on "Packages" in the left sidebar
3. You should see the `labs` package
4. Click on it to view details about the Docker image
5. Note the image tag (usually `latest`) and the SHA digest
Expand All @@ -120,7 +123,7 @@ So far so good :tada:. We will go a lot more in detail with Kosli in the next se
Before moving to the next lab, ensure you have:

- ✅ A Kosli account at app.kosli.com with an organization created
- ✅ A forked copy of the labs repository under your GitHub account
- ✅ A copy of the labs repository under your GitHub account
- ✅ GitHub Actions successfully completed all jobs in the workflow
- ✅ A Docker image published to your GitHub Container Registry
- ✅ Understanding of the basic pipeline structure
Expand Down
Loading