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 “settings” next to your project on the dashboard.
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 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 post job commands that execute after each job, even if a job command failed.