Creating an Integration
You can add this integration by following steps on the Managing Pipelines Integrations page.
Here is the information you need to create this integration:
- Name -- choose a friendly name for the integration
- url -- your GitHub API endpoint. This is already hard-coded to https://api.github.com
Token -- your GitHub personal access token with the permissions needed to run your jobs
Token permissions
To use this integration as a pipeline source, your token must be granted these permissions at minimum:
- repo (all)
- admin:repo_hook (read, write)
- admin:public_key (read, write)
Additionally, if your organization uses SAML single sign-on, you will need to authorize your token.
Usage
The GitHub integration can be used in the GitRepo resource.
The GitHub integration can also be added directly to a step in the integrations
section.
Default Environment Variables
When you create a resource with this integration, and create a step that uses it, a set of environment variables is automatically made available.
Environment variable | Description |
---|---|
res_<resource-name>_gitProvider_url | GitHub API location |
res_<resource-name>_gitProvider_token | The Token used to connect to GitHub |
When you add this integration directly to a step, a set of environment variables is automatically made available.
Environment variable | Description |
---|---|
int_<integration-name>_url | GitHub API location |
int_<integration-name>_token | The Token used to connect to GitHub |
Examples
This example shows how to configure an NpmBuild step using default locations and default commands. It assumes that an Artifactory integration named myGithub
has been created.
- This example uses a values.yml file to store the pipeline definitions.
- The YAML for this example is available in this repository in the JFrog GitHub account.
- For more information about running this example, see Pipeline Example: Npm Build.
# This config file is templatized so that it can be easily customized. Values can be provided with a values.yml file. template: true # required for local templates valuesFilePath: ./values.yml resources: - name: npm_repo_jfp_example type: GitRepo configuration: # SCM integration where the repository is located gitProvider: {{ .Values.myRepo.gitProvider }} # Repository path, including org name/repo name path: {{ .Values.myRepo.path }} branches: # Specifies which branches will trigger dependent steps include: master - name: npm_buildinfo_jfp_example type: BuildInfo configuration: sourceArtifactory: demoArt pipelines: - name: npm_pipeline_jfp_example steps: - name: npm_build_step type: NpmBuild configuration: repositoryName: npm-virtual # required, npm repository name on artifacctory sourceLocation: . # required, location of package.json file integrations: - name: demoArt # required inputResources: - name: npm_repo_jfp_example # required