Skip to content

DeadmanXXXII/Travis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Travis

Here’s an in-depth list of travis CLI commands with detailed descriptions and advanced techniques:

Travis CI CLI Commands

1. Authentication and Setup

  • Authenticate with Travis CI:

    travis login

    Logs in to Travis CI using your GitHub account. Follow the prompts to authenticate.

  • Logout from Travis CI:

    travis logout

    Logs out from Travis CI, invalidating the current session.

  • Check authentication status:

    travis whoami

    Displays information about the currently authenticated user.

2. Repository Management

  • Add a repository to Travis CI:

    travis enable

    Enables a repository for Travis CI builds. Run this command in a repository directory to enable it.

  • Remove a repository from Travis CI:

    travis disable

    Disables a repository from Travis CI. This stops builds from being triggered for this repository.

  • List repositories:

    travis repos

    Lists the repositories available to the authenticated user.

  • View repository settings:

    travis repo

    Shows configuration details for the current repository.

3. Build Management

  • Trigger a build:

    travis build

    Manually triggers a build for the current repository. You can pass options like --branch or --message to specify the branch or commit message.

  • Trigger a build with specific branch:

    travis build --branch <branch_name>

    Triggers a build for a specified branch.

  • View build status:

    travis status

    Displays the status of the most recent build.

  • View detailed build information:

    travis show <build_id>

    Displays detailed information about a specific build identified by <build_id>.

  • Restart a build:

    travis restart <build_id>

    Restarts a specific build identified by <build_id>. Useful for re-running a failed build.

  • Cancel a build:

    travis cancel <build_id>

    Cancels a specific build identified by <build_id>. This can be useful if a build is stuck or no longer needed.

  • List recent builds:

    travis builds

    Lists recent builds with their statuses.

4. Build Logs and History

  • View recent build logs:

    travis logs

    Displays logs for recent builds.

  • View logs for a specific build:

    travis logs <build_id>

    Displays logs for a specific build identified by <build_id>. Useful for debugging.

  • Download build logs:

    travis logs <build_id> --download

    Downloads the logs for a specific build.

5. Configuration

  • View current Travis CI configuration:

    travis show

    Shows the configuration for the current repository, including settings and environment variables.

  • Update repository configuration:

    travis config

    Updates the configuration for the current repository. This can include environment variables, build settings, and more.

  • Set environment variables:

    travis env --set VARIABLE_NAME=value

    Sets environment variables for the repository.

  • Unset environment variables:

    travis env --unset VARIABLE_NAME

    Unsets environment variables for the repository.

6. Notifications

  • View recent notifications:

    travis notifications

    Displays recent notifications related to Travis CI builds.

  • Manage notifications:

    travis notifications --add <notification_config>

    Adds a new notification configuration.

  • Remove notifications:

    travis notifications --remove <notification_id>

    Removes a specific notification configuration.

7. User Management

  • List user settings:

    travis settings

    Lists settings for the authenticated user.

  • Update user settings:

    travis settings <setting_name>=<value>

    Updates a specific setting identified by <setting_name> with a new <value>.

  • Manage user permissions:

    travis permissions --add <permission>

    Adds permissions for the authenticated user.

8. Version and Help

  • Show CLI version:

    travis --version

    Displays the version of the Travis CLI.

  • Get help for a command:

    travis help <command>

    Provides help information for a specific <command>.

  • List all commands:

    travis help

    Lists all available commands and provides a brief description.

Advanced Techniques

  • Using .travis.yml for Configurations: Ensure your repository has a .travis.yml file for configuring builds. This YAML file specifies the build environment, language, and scripts to run.

  • Matrix Builds: Configure matrix builds in .travis.yml to run tests across multiple environments. Example:

    matrix:
      include:
        - os: linux
          dist: xenial
          language: python
          python: 3.6
        - os: osx
          language: python
          python: 3.7
  • Deployments: Configure automatic deployments in .travis.yml to deploy to various services upon successful builds. Example:

    deploy:
      provider: s3
      access_key_id: $AWS_ACCESS_KEY_ID
      secret_access_key: $AWS_SECRET_ACCESS_KEY
      bucket: my-bucket
      region: us-east-1
      local-dir: build/
  • Conditional Builds: Use conditionals to run certain builds based on the branch or tags:

    jobs:
      include:
        - stage: test
          script: ./run_tests.sh
          if: branch = master
  • Custom Build Scripts: Define custom build scripts for more complex workflows. Example:

    script:
      - ./custom_script.sh

Summary

This comprehensive list provides both basic and advanced commands for interacting with Travis CI using the travis CLI. It covers authentication, repository management, build management, configuration, notifications, user management, and advanced techniques for custom configurations and deployments.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published