Skip to content

carlosthe19916/keycloak-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Keycloak Admin CLI

Github Action for executing Keycloak Admin CLI against a defined server.

You can read more about Keycloak Admin CLI in the official documentation.

Usage

To execute one or more commands using the Keycloak Admin CLI within your Github Actions pipeline include carlosthe19916/[email protected] in your workflow.yml file.

Inside your .github/workflows/workflow.yml file:

steps:
- uses: actions/checkout@v2
- name: Keycloak Admin CLI
  uses: carlosthe19916/[email protected]
  with:
    version: latest
    server: http://keycloak:8080
    username: admin
    password: password
    kcadm: create realms -f openubl-realm.json

To execute more than one command:

steps:
- uses: actions/checkout@v2
- name: Keycloak Admin CLI
  uses: carlosthe19916/[email protected]
  with:
    server: http://keycloak:8080/auth
    username: admin
    password: password
    kcadm: |
      create realms -f openubl-realm.json
      create clients -r openubl -s clientId=myClient -s enabled=true

Arguments

There are 6 arguments available:

Input Description Usage
version The Keycloak client version to use
server The server URL e.g. http://localhost:8080/auth Required
username The username to start a session. Required
password The password to start a session. Required
realm The realm to start a session against to (default master). Optional
client The client to start a session against to (default admin-cli). Optional
kcadm The command (or commands) to execute after authenticated in Keycloak e.g. update realms/rhamt -f rhamt-realm.json . To execute more than one command, use "|" and type the commands on multiple lines. Required
server-wait-timeout Time (seconds) to wait until server is available (default 120 seconds). Optional

Example workflow.yml with keycloak Admin CLI

name: Example workflow for Keycloak Admin CLI
on: [push]
jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - name: Init Keycloak
        run: |
          docker run -d --name keycloak -p 8080:8080 \
          -e KEYCLOAK_ADMIN=admin \
          -e KEYCLOAK_ADMIN_PASSWORD=password \
          quay.io/keycloak/keycloak:latest start-dev
      - name: Keycloak Admin CLI
        uses: carlosthe19916/[email protected]
        with:
          version: latest
          server: http://keycloak:8080
          username: admin
          password: password
          kcadm: |
            get realms

About

Executes Keycloak Admin CLI against a defined server.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •