|
| 1 | +--- |
| 2 | +title: "Lab 1: Get Ready" |
| 3 | +description: "Create a Kosli account, fork the sample repository, verify the CI/CD pipeline, and install the Kosli CLI." |
| 4 | +icon: rocket |
| 5 | +--- |
| 6 | + |
| 7 | +## Learning goals |
| 8 | + |
| 9 | +- Create a Kosli account and organization |
| 10 | +- Create a copy of the sample application repository |
| 11 | +- Verify the CI/CD pipeline runs successfully |
| 12 | +- Install the Kosli CLI and create an API key |
| 13 | +- Understand the basic structure of the application and its deployment process |
| 14 | + |
| 15 | +## Introduction |
| 16 | + |
| 17 | +Before diving into Kosli's features, you need to set up your account and verify that your sample application builds and deploys correctly. |
| 18 | + |
| 19 | +This lab uses a simple Java application with a complete CI/CD pipeline already configured in GitHub Actions. The pipeline builds the application, creates a Docker image, runs tests, and deploys it. In subsequent labs, you'll integrate Kosli to track all these activities. |
| 20 | + |
| 21 | +## Exercise |
| 22 | + |
| 23 | +<Steps> |
| 24 | + <Step title="Create a Kosli account"> |
| 25 | + - Navigate to [app.kosli.com/sign-up](https://app.kosli.com/sign-up) |
| 26 | + - Choose to sign up with GitHub |
| 27 | + - Complete the registration process and verify your email if required |
| 28 | + - Log in to [app.kosli.com](https://app.kosli.com) |
| 29 | + </Step> |
| 30 | + |
| 31 | + <Step title="Fork the sample repository"> |
| 32 | + - Navigate to [github.com/kosli-dev/labs](https://github.com/kosli-dev/labs) |
| 33 | + - Click the **Use this template** button in the top-right corner |
| 34 | + - Select **Create a new repository** |
| 35 | + - Set your personal GitHub account as the **Owner** and name the repository `labs` |
| 36 | + - Click **Create repository from template** |
| 37 | + |
| 38 | + <Tip> |
| 39 | + From now on, "your repository" refers to your copy of the labs repository at `https://github.com/YOUR-GITHUB-USERNAME/labs`. |
| 40 | + </Tip> |
| 41 | + </Step> |
| 42 | + |
| 43 | + <Step title="Enable GitHub Actions"> |
| 44 | + 1. Go to your repository on GitHub |
| 45 | + 2. Click the **Actions** tab |
| 46 | + 3. If prompted, click **I understand my workflows, go ahead and enable them** |
| 47 | + 4. If the workflow doesn't start automatically, trigger it manually: |
| 48 | + - Click **Main workflow** in the left sidebar |
| 49 | + - Click **Run workflow**, select `main`, and click **Run workflow** |
| 50 | + </Step> |
| 51 | + |
| 52 | + <Step title="Verify the pipeline"> |
| 53 | + In the **Actions** tab, click the most recent workflow run and observe the jobs: |
| 54 | + |
| 55 | + | Job | What it does | |
| 56 | + |-----|-------------| |
| 57 | + | Build | Compiles the Java application using Gradle | |
| 58 | + | Linting | Checks code quality (warnings are expected) | |
| 59 | + | Docker-image | Builds and pushes a Docker container image | |
| 60 | + | Security-scan | Scans the Docker image for vulnerabilities | |
| 61 | + | Component-test | Runs integration tests | |
| 62 | + | Performance-test | Runs basic performance checks | |
| 63 | + | Deploy | Starts and stops the application container | |
| 64 | + |
| 65 | + Wait for all jobs to show green checkmarks. |
| 66 | + |
| 67 | + <Frame> |
| 68 | + <img src="/images/labs/pipeline.png" alt="GitHub Actions pipeline showing all jobs completing successfully" /> |
| 69 | + </Frame> |
| 70 | + |
| 71 | + <Tip> |
| 72 | + The pipeline may take 3–6 minutes on the first run. GitHub Actions provides free minutes for public repositories. |
| 73 | + </Tip> |
| 74 | + |
| 75 | + <Accordion title="Common issues"> |
| 76 | + - **Docker-image job fails with permission error**: Make sure your repository has package write permissions enabled. |
| 77 | + - **Linting shows warnings**: This is expected and won't fail the build (`DISABLE_ERRORS` is set to `true`). |
| 78 | + </Accordion> |
| 79 | + </Step> |
| 80 | + |
| 81 | + <Step title="Install the Kosli CLI"> |
| 82 | + Run the one-line install script: |
| 83 | + |
| 84 | + ```bash |
| 85 | + curl -fL https://raw.githubusercontent.com/kosli-dev/cli/refs/heads/main/install-cli.sh | sh |
| 86 | + |
| 87 | + # Verify installation |
| 88 | + kosli version |
| 89 | + ``` |
| 90 | + |
| 91 | + <Tip> |
| 92 | + If this method fails, see [Install Kosli CLI](/getting_started/install) for alternative installation options (Homebrew, APT, Docker, etc.). |
| 93 | + </Tip> |
| 94 | + </Step> |
| 95 | + |
| 96 | + <Step title="Create a Kosli API key"> |
| 97 | + - Log in to [app.kosli.com/settings/profile](https://app.kosli.com/settings/profile) |
| 98 | + - Navigate to the **API Keys** section |
| 99 | + - Click **Add API Key**, give it a name (e.g., "CLI Access"), and copy the key immediately — it won't be shown again |
| 100 | + |
| 101 | + Configure it for local use: |
| 102 | + |
| 103 | + ```bash |
| 104 | + export KOSLI_API_TOKEN="your-api-key-here" |
| 105 | + export KOSLI_ORG="your-gh-username" |
| 106 | + ``` |
| 107 | + |
| 108 | + Verify the CLI can reach Kosli: |
| 109 | + |
| 110 | + ```bash |
| 111 | + kosli list flows |
| 112 | + ``` |
| 113 | + |
| 114 | + You should see "No flows were found" — which confirms authentication is working. |
| 115 | + |
| 116 | + <Warning> |
| 117 | + Never commit API keys to your repository. You'll add this key to GitHub Secrets in Lab 2. |
| 118 | + </Warning> |
| 119 | + |
| 120 | + See [Service Accounts](/getting_started/service-accounts) for more on API key management. |
| 121 | + </Step> |
| 122 | + |
| 123 | + <Step title="Explore the workflow file"> |
| 124 | + In your repository, navigate to `.github/workflows/full-pipeline.yaml` and review the structure: |
| 125 | + |
| 126 | + - Notice how it triggers on every push |
| 127 | + - Observe the environment variables at the top |
| 128 | + - See how artifacts are shared between jobs using `upload-artifact` and `download-artifact` |
| 129 | + - Note the dependencies between jobs (e.g., Docker-image requires Build to complete first) |
| 130 | + |
| 131 | + In later labs, you'll add Kosli integration to this file. |
| 132 | + </Step> |
| 133 | + |
| 134 | + <Step title="View the published Docker image"> |
| 135 | + 1. Go to your GitHub profile page |
| 136 | + 2. Click the **Packages** tab |
| 137 | + 3. You should see the `labs` package |
| 138 | + 4. Click it to view the Docker image details — note the image tag (`latest`) and SHA digest |
| 139 | + |
| 140 | + <Tip> |
| 141 | + The Docker image is automatically published to GitHub Container Registry (`ghcr.io`) by the pipeline. |
| 142 | + </Tip> |
| 143 | + </Step> |
| 144 | +</Steps> |
| 145 | + |
| 146 | +## Verification checklist |
| 147 | + |
| 148 | +Before moving to the next lab, confirm: |
| 149 | + |
| 150 | +- [ ] Kosli account created at app.kosli.com |
| 151 | +- [ ] Copy of the labs repository under your GitHub account |
| 152 | +- [ ] GitHub Actions completed all jobs successfully |
| 153 | +- [ ] Docker image published to your GitHub Container Registry |
| 154 | +- [ ] Kosli CLI installed (`kosli version` works) |
| 155 | +- [ ] API key created and `kosli list flows` returns successfully |
| 156 | +- [ ] You understand the basic pipeline structure |
| 157 | + |
| 158 | +## Next steps |
| 159 | + |
| 160 | +Continue to [Lab 2: Flows and Trails](/labs/lab-02-flows-and-trails) to create your first Flow and Trail and integrate them into your pipeline. |
0 commit comments