Getting started overview
Codeship provides continuous integration (CI) and continuous deployment (CD) services designed to automate the software development lifecycle. The platform automates testing, building, and deploying code changes, supporting various programming languages and deployment targets. Codeship offers two primary products: Codeship Basic, which provides a streamlined setup for common CI/CD workflows, and Codeship Pro, which offers more granular control through custom Docker environments and defined service and step files (Codeship Pro services and steps configuration).
This guide outlines the initial steps required to set up an account, connect a project, and configure a basic build and deployment pipeline. The process involves linking a version control system (VCS), defining build commands, and specifying deployment targets. Codeship aims to reduce manual intervention in the delivery process, making it suitable for teams focused on frequent, reliable releases. For more detailed information on Codeship's offerings, refer to the official Codeship documentation.
Create an account and get keys
To begin using Codeship, an account must be created. Codeship integrates directly with popular version control systems (VCS) for authentication and project linking.
Signup process
- Navigate to the Codeship website: Access the Codeship homepage.
- Initiate signup: Click on the "Sign Up" or "Get Started Free" button. Codeship offers a free tier for open-source projects.
- Choose VCS integration: You will be prompted to select a version control provider. Options typically include GitHub, Bitbucket, and GitLab. Authorizing Codeship through your chosen VCS grants the necessary permissions to access your repositories. This authorization is managed via OAuth, a standard protocol for secure delegated access (OAuth documentation).
- Select an organization (optional): If your VCS account is part of multiple organizations, select the relevant one.
- Confirm permissions: Review the permissions Codeship requests for your VCS account. These permissions typically include access to repositories, webhooks, and commit status.
API keys and credentials
Codeship primarily interacts with your repositories and deployment targets using the authorized VCS connection and project-specific environment variables. Direct API keys for Codeship itself for programmatic control are available for advanced use cases, but for initial setup, the focus is on integrating with your existing VCS and cloud providers.
- VCS Integration: Once authorized, Codeship automatically configures webhooks in your repository. These webhooks notify Codeship of new commits, triggering builds (GitHub integration details).
- Deployment Credentials: For deploying applications to cloud providers (e.g., AWS, Google Cloud Platform, Heroku), you will configure credentials within your Codeship project settings. These often include API keys, access tokens, or SSH keys, which Codeship securely stores as encrypted environment variables.
Your first request
A "first request" in the context of Codeship typically refers to triggering your first automated build and deployment. This involves creating a new project in Codeship and configuring its CI/CD pipeline.
Creating a new project
- Log in to Codeship: After signup, log into your Codeship dashboard.
- Add a new project: Click "New Project" or a similar prompt.
- Select repository: Choose the repository from your connected VCS that you wish to integrate with Codeship. Codeship will list repositories accessible through your authorized VCS account.
- Choose project type: Select either Codeship Basic or Codeship Pro. For a quick start with common stacks, Codeship Basic is often sufficient. For Docker-native workflows and more control, choose Codeship Pro.
Configuring the build pipeline (Codeship Basic)
For Codeship Basic, the configuration is primarily done through the web interface:
- Setup Commands: Define commands to install dependencies (e.g.,
bundle installfor Ruby,npm installfor Node.js). - Test Commands: Specify commands to run your tests (e.g.,
rspec,npm test). Codeship executes these commands in a clean environment for each build. - Deployment: Configure deployment steps. This might involve selecting a service like Heroku, AWS Elastic Beanstalk, or Google Cloud Run, and providing the necessary credentials and commands.
Configuring the build pipeline (Codeship Pro)
Codeship Pro uses codeship-services.yml and codeship-steps.yml files, typically located at the root of your repository, for configuration. These files define your Docker services and build/deployment steps.
codeship-services.yml: Defines the Docker images and services required for your build and test environment. This is similar to adocker-compose.ymlfile. Example:
version: "2"
services:
app:
build:
context: .
dockerfile: Dockerfile
postgres:
image: postgres:9.6
environment:
- POSTGRES_DB=test_db
codeship-steps.yml: Defines the sequential steps for your CI/CD pipeline, referencing the services defined incodeship-services.yml. Example:
- name: tests
service: app
command: bundle exec rspec
- name: deploy_staging
service: app
tag: master
deployment:
branch: master
steps:
- command: deploy_to_heroku.sh
Once these files are committed and pushed to your repository, Codeship will automatically detect them and trigger a build.
Triggering the first build
- Commit and push: Make a code change (even a minor one) and push it to the branch connected to Codeship (e.g.,
masterormain). - Monitor build status: Return to your Codeship dashboard. You should see a new build initiated for your project. You can click on the build to view its real-time logs and status.
Common next steps
After successfully completing your first build, consider these common next steps:
- Refine build configuration: Optimize build times by caching dependencies or parallelizing tests.
- Add more environments: Configure staging and production deployment pipelines with different credentials and deployment targets.
- Integrate with notifications: Set up notifications for build status via Slack, email, or other services (Codeship notification integrations).
- Review environment variables: Securely manage sensitive information like API keys and database credentials using Codeship's encrypted environment variables.
- Explore advanced features: For Codeship Pro, investigate custom Docker image building, monorepo support, or more complex deployment strategies with custom scripts.
Troubleshooting the first call
Encountering issues during the initial setup is common. Here's a quick reference for troubleshooting a failed first build or deployment:
| Issue | What to do | Where to check |
|---|---|---|
| Build not starting | Ensure webhook is correctly installed and active. Check VCS permissions. | Codeship project settings > Integrations; VCS repository settings > Webhooks |
| Dependency installation failure | Verify setup commands in Codeship Basic or codeship-services.yml for Codeship Pro. Check for correct versions and paths. |
Codeship project setup tab (Basic); codeship-services.yml (Pro) |
| Test command failure | Review test commands for syntax errors or missing dependencies. Ensure tests pass locally. | Codeship project test tab (Basic); codeship-steps.yml (Pro) |
| Deployment failure | Check deployment credentials, environment variables, and deployment scripts/commands. Verify target server accessibility. | Codeship project deployment tab (Basic); codeship-steps.yml and environment variables (Pro) |
| Permissions errors | Confirm Codeship has adequate read/write permissions on your VCS and target deployment environment. | VCS organization/repository settings; Codeship project settings > Integrations |
| Configuration file issues (Pro) | Validate YAML syntax for codeship-services.yml and codeship-steps.yml. Ensure files are at the repository root. |
Local repository; Codeship build logs will show parsing errors |
Always review the detailed build logs within the Codeship dashboard. These logs provide real-time output from your build environment and are the primary source for diagnosing failures. For persistent issues, consult the Codeship troubleshooting documentation.