Skip to content
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
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ RUN mkdir /tmp/helm_env/ && \
mv linux-amd64/helm /usr/local/bin/helm && \
rm -rf /tmp/helm_env/

# Install GitHub CLI
ARG GH_VERSION=2.96.0
RUN mkdir /tmp/gh_env/ && \
cd /tmp/gh_env/ && \
wget https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz && \
tar -xvzf gh_${GH_VERSION}_linux_amd64.tar.gz && \
cp gh_${GH_VERSION}_linux_amd64/bin/gh /usr/local/bin/gh && \
rm -rf /tmp/gh_env/

# Install AwsCLI
ARG AWSCLI_VERSION=2.35.21
RUN mkdir /tmp/awscli_env/ && \
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

## Key Features

- **Comprehensive Toolset**: Pre-installed with tools like Git, Python, Ansible, Terraform, kubectl, Helm, AWS CLI, Azure CLI, and more.
- **Comprehensive Toolset**: Pre-installed with tools like Git, Python, Ansible, Terraform, kubectl, Helm, GitHub CLI, AWS CLI, Azure CLI, and more.
- **Easy Integration**: Use it directly or customize it with your preferred versions.
- **Efficient Updates**: Weekly updates ensure the latest versions and security patches.
- **Configuration Reusability**: Mounts host config folders for seamless reuse across sessions.
Expand Down Expand Up @@ -113,6 +113,7 @@ Built on `ubuntu:24.04` base image
| Terraform | TERRAFORM_VERSION=1.15.8 | [Check](https://releases.hashicorp.com/terraform/) | [terraform_usage](./docs/usage/terraform_usage.md) |
| Kubectl | KUBECTL_VERSION=1.36.2 | [Check](https://dl.k8s.io/release/stable.txt) | [kubectl_usage](./docs/usage/kubectl_usage.md) |
| Helm | HELM_VERSION=3.21.3 | [Check](https://github.com/helm/helm/releases) | [helm_usage](./docs/usage/helm_usage.md) |
| GitHub CLI | GH_VERSION=2.96.0 | [Check](https://github.com/cli/cli/releases) | [githubcli_usage](./docs/usage/githubcli_usage.md) |
| AwsCLI | AWSCLI_VERSION=2.35.21 | [Check](https://raw.githubusercontent.com/aws/aws-cli/v2/CHANGELOG.rst) | [awscli_usage](./docs/usage/awscli_usage.md) |
| AzureCLI | AZURECLI_VERSION=2.88.0 | [Check](https://learn.microsoft.com/en-us/cli/azure/release-notes-azure-cli) | [azurecli_usage](./docs/usage/azurecli_usage.md) |
| PowerShell | PS_VERSION=7.6.3 | [Check](https://github.com/PowerShell/PowerShell/releases) | [powershell_usage](./docs/usage/powershell_usage.md) |
Expand Down
4 changes: 4 additions & 0 deletions docs/usage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ This guide us how to use the `devops-toolkit` with serveral usecases

- Check [**helm_usage**](./helm_usage.md)

## GitHub CLI

- Check [**githubcli_usage**](./githubcli_usage.md)

## AwsCLI

- Check [**awscli_usage**](./awscli_usage.md)
Expand Down
66 changes: 66 additions & 0 deletions docs/usage/githubcli_usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Use GitHub CLI in the devops-toolkit

## Prerequisite

A GitHub account

## GitHub CLI document

Some document to help you start with GitHub CLI (`gh`)

- <https://cli.github.com/manual/>
- <https://docs.github.com/en/github-cli>

## Run with Docker command

### Note

To use the existing container instead of creating one, use `docker exec` command instead of `docker run`

```bash
docker exec -it my_devops_toolkit /bin/bash
```

### Common Run Modes

For instructions on common run modes, visit [**DevOps Toolkit Common Run Mode**](../usage/run_mode.md).

### Use case 1: Authenticate and list your repositories

```bash
docker run --rm --network host -it -v ~/.dtc:/dtc tungbq/devops-toolkit:latest
###############################################
# Now we are in the docker container terminal #
###############################################
# Log in (follow the device-code flow in your browser)
gh auth login
# List your repositories
gh repo list
```

Sample Result

```bash
root@docker-desktop:~# gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations on this host? HTTPS
? How would you like to authenticate GitHub CLI? Login with a web browser

! First copy your one-time code: XXXX-XXXX
Press Enter to open github.com in your browser...
✓ Authentication complete.
✓ Logged in as octocat
```

### Use case 2: Work with pull requests and issues

```bash
# From inside an existing git repository
gh pr list
gh pr create --title "My change" --body "Description"
gh issue list
```

### Troubleshooting

- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md)
7 changes: 7 additions & 0 deletions samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ helm repo add bitnami https://charts.bitnami.com/bitnami
helm search repo bitnami | grep jenkins
```

## GitHub CLI

```bash
# Check GitHub CLI version
gh --version
```

## AwsCLI

- TODO
Expand Down
6 changes: 6 additions & 0 deletions samples/run_sample.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,9 @@ console_log "Running Helm sample: add and search"
helm repo add bitnami https://charts.bitnami.com/bitnami
helm search repo bitnami | grep jenkins

###########
# GitHub CLI
###########
console_log "Running GitHub CLI sample: check version"
gh --version

4 changes: 4 additions & 0 deletions scripts/check_latest_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ def main(output_file):
helm_version = version_parser.check_github_release_version("Helm", "helm/helm")
versions["helm"] = helm_version

# GitHub CLI
githubcli_version = version_parser.check_github_release_version("GitHub CLI", "cli/cli")
versions["githubcli"] = githubcli_version

# Awscli
awscli_version = version_parser.check_awscli_version()
versions["awscli"] = awscli_version
Expand Down
3 changes: 3 additions & 0 deletions scripts/check_version_in_toolkit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ansible_version=$(cat "$toolkit_info_path" | jq -r '.ansible')
terraform_version=$(cat "$toolkit_info_path" | jq -r '.terraform')
kubectl_version=$(cat "$toolkit_info_path" | jq -r '.kubectl')
helm_version=$(cat "$toolkit_info_path" | jq -r '.helm')
githubcli_version=$(cat "$toolkit_info_path" | jq -r '.githubcli')
awscli_version=$(cat "$toolkit_info_path" | jq -r '.awscli')
azurecli_version=$(cat "$toolkit_info_path" | jq -r '.azurecli')
pwsh_version=$(cat "$toolkit_info_path" | jq -r '.pwsh')
Expand All @@ -20,6 +21,7 @@ echo "ansible_version=$ansible_version"
echo "terraform_version=$terraform_version"
echo "kubectl_version=$kubectl_version"
echo "helm_version=$helm_version"
echo "githubcli_version=$githubcli_version"
echo "awscli_version=$awscli_version"
echo "azurecli_version=$azurecli_version"
echo "pwsh_version=$pwsh_version"
Expand All @@ -31,6 +33,7 @@ declare -A tools=(
[terraform]="$terraform_version"
[kubectl]="$kubectl_version"
[helm]="$helm_version"
[gh]="$githubcli_version"
[aws]="$awscli_version"
[az]="$azurecli_version"
[pwsh]="$pwsh_version"
Expand Down
1 change: 1 addition & 0 deletions scripts/update_latest_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def update_readme(readme_path, version_arg, new_version):
{"name": "terraform", "version_arg": "TERRAFORM_VERSION"},
{"name": "kubectl", "version_arg": "KUBECTL_VERSION"},
{"name": "helm", "version_arg": "HELM_VERSION"},
{"name": "githubcli", "version_arg": "GH_VERSION"},
{"name": "awscli", "version_arg": "AWSCLI_VERSION"},
{"name": "azurecli", "version_arg": "AZURECLI_VERSION"},
{"name": "pwsh", "version_arg": "PS_VERSION"}
Expand Down
1 change: 1 addition & 0 deletions toolkit_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"terraform": "1.15.8",
"kubectl": "1.36.2",
"helm": "3.21.3",
"githubcli": "2.96.0",
"awscli": "2.35.21",
"azurecli": "2.88.0",
"pwsh": "7.6.3"
Expand Down
Loading