Docs Navigation

Customizing build commands

You can easily customize commands that Semaphore executes in order to build your project.

Typical use cases for custom build commands that we have seen so far are:

  • setting up custom database configuration files
  • calling a custom rake task for setting up seed db data
  • passing special flags to default rake tasks
  • exporting environment variables that contain sensitive information which you don’t want to keep in your repository

Each build or deploy command is executed as a Linux shell command.

To edit a project build commands, click on "Project settings" on the project page.

You will see the commands editor page with your current build commands.

Adding a new command

If your plan allows multiple jobs, you can add a new job by clicking on "Parallel job" link.

A new job will show up, where you can add new commands.

Alternatively, you can drag an existing command to the new job. The drag handler will show up when you move the mouse pointer over a command.

Deleting a command

When you move the mouse pointer over a command, you will see an option that allows you to remove the command.

Editing a command

If you want to edit a single command, click on the command to activate editing. You can confirm the new command by pressing Enter or cancel editing by pressing Escape key.

Setup commands

Setup commands are executed before each job. Usually, setup commands install the application dependencies, gems, create database and set configuration files.

To create a new setup, click on the "Setup" link on the bottom of the page.

This will create the Setup area where you can add setup commands.

A project can have only one setup.

Editing a job

If you want to edit multiple commands at once or you want to paste few commands, click on the "Edit job" link. This will show text area where you can insert your commands.

Deleting a job

To delete a job, click "x" link in the top right corner of the tread. If the tread is not empty - you need to confirm that the job and all commands should be deleted.

Renaming a job

Jobs can be named. The name of a jobs will be displayed on the build page. To name a job, click on the "Rename" link.

Commands editor allows you to add after job commands that execute after each job, even if a job command failed.

Note that Semaphore exports some environment variables which might be useful to you. You can also install additional packages with commands like sudo apt-get install -y something.

Semaphore Docs are open source — Edit on GitHub

Newsletter

Occasional lightweight product and blog updates. Unsubscribe at any time.

2009-2017 © Rendered Text. All rights reserved. Terms of Service, Privacy policy, Security.