Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an OIDC integration GitHub Actions example #381

Merged
merged 1 commit into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Setup JFrog CLI OIDC Example"
on: push

permissions:
# This is required for requesting the OIDC token
id-token: write
# This is required for actions/checkout
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JFrog CLI
uses: jfrog/setup-jfrog-cli@v4
env:
# JFrog platform url (for example: https://acme.jfrog.io)
JF_URL: ${{ secrets.JF_URL }}
with:
# Name of the OIDC provider as specified on the OIDC integration page in the JFrog Platform
oidc-provider-name: setup-jfrog-cli

- name: Run JFrog CLI
run: |
# Ping the server
jf rt ping
# Collect environment variables for the build
jf rt bce
# Collect VCS details from git and add them to the build
jf rt bag
# Publish build info
jf rt bp
29 changes: 29 additions & 0 deletions github-action-examples/oidc-github-actions-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# OIDC Github Action Example

This is an example of a basic GitHub workflow that uses the [Setup JFrog CLI GitHub Action](https://github.com/jfrog/setup-jfrog-cli) with an [OIDC integration](https://openid.net/developers/how-connect-works) between the JFrog Platform and GitHub Actions.

## Creating the OIDC Integration

This phase sets an OIDC integration between GitHub Actions to the JFrog platform.

1. Navigate to the Administration tab In the JFrog Platform UI
2. Click `Platform Management` | `Manage Integrations`
3. Click `New Integration` | `OpenID Connect`:
![New Integration](images/new_oidc_integration.png)
4. Configure the OIDC integration:
![Configure OIDC Integration](images/configure_oidc_integration.png)
5. Configure the Identity Mapping:

![Configure Identity Mapping](images/identity_mapping.png)

## Running the Example

1. Create a new Github repository.
2. In the Github repository you created, create a [secret](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) named _JF_URL_. Set the value of the secret to be the JFrog Platform URL, such as https://acme.jfrog.io.
3. Push the [workflow.yml](.github/workflows/workflow.yml) file as part of this example, under `.github/workflows/` in your Github repository.
4. Watch the workflow running following any push to the repository.

## Resources

- [OpenID Connect Integration](https://jfrog.com/help/r/jfrog-platform-administration-documentation/openid-connect-integration)
- [Secure Access To Your Software Development with GitHub OpenID Connect (OIDC) and JFrog](https://jfrog.com/blog/secure-access-development-jfrog-github-oidc)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "JFrog CLI Example"
name: "Setup JFrog CLI Example"
on: push

jobs:
Expand Down
8 changes: 5 additions & 3 deletions github-action-examples/simple-github-action-example/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Simple Github Action Example

This is an example Github workflow, which uses the [Setup JFrog CLI Github Action](https://github.com/jfrog/setup-jfrog-cli).

## Running the Example

1. Create a new Github repository.
2. Make sure you have version **1.46.4** or above of [JFrog CLI](https://jfrog.com/getcli/) on your local machine, by running ```jfrog -v```.
3. Configure the details of your Artifactory server by running ```jfrog c add```.
4. Using the server ID you configured, export the server details by running ```jfrog c export <Server ID>```.
2. Make sure you have version **1.46.4** or above of [JFrog CLI](https://jfrog.com/getcli/) on your local machine, by running `jfrog -v`.
3. Configure the details of your Artifactory server by running `jfrog c add`.
4. Using the server ID you configured, export the server details by running `jfrog c export <Server ID>`.
5. Copy the generated token to the clipboard.
6. In the Github repository you created, create a [secret](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables) named JF_SECRET_ENV_1. Set the value of the secret to be the generated token you copied to the clipboard.
7. Push the [workflow.yml](workflow.yml) file as part of this example, under `.github/workflows/` in your Github repository.
Expand Down
Loading