Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Commit

Permalink
Updating README & refactor release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
containerscrew committed Nov 17, 2023
1 parent f40c72c commit 8101115
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: |
export RUSTFLAGS="-Cinstrument-coverage"
cargo build --verbose
LLVM_PROFILE_FILE="your_name-%p-%m.profraw" cargo test --verbose
LLVM_PROFILE_FILE="aws-sso-auth-%p-%m.profraw" cargo test --verbose
grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info
- name: Upload Code Coverage
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Gitleaks
on:
pull_request:
push:
workflow_dispatch:
schedule:
- cron: "0 4 * * *" # run once a day at 4 AM
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,14 @@ jobs:
with:
toolchain: stable

- name: Build Project
run: cargo build --release --target ${{ runner.os }}-${{ matrix.arch }}
- name: Build for ${{ matrix.os }} - ${{ matrix.arch }}
if: matrix.os == 'ubuntu-latest'
run: |
make release
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: aws-sso-auth-${{ matrix.os }}-${{ matrix.arch }}
path: target/release/
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BUILD_TIME = $(shell date +"%Y/%m/%d %H:%M:%S")
GIT_REVISION = $(shell git log -1 --format="%h")
RUST_VERSION = $(word 2, $(shell rustc -V))
LONG_VERSION = "$(VERSION) ( rev: $(GIT_REVISION), rustc: $(RUST_VERSION), build at: $(BUILD_TIME) )"
BIN_NAME = aws-sso-rs
BINARY_NAME = aws-sso-auth

export LONG_VERSION

Expand All @@ -19,9 +19,6 @@ doctoc: ## Create table of contents with doctoc
pre-commit: ## Run pre-commit
pre-commit run -a

release_mac: ## Start release for Mac OSX
cargo build --release --target=x86_64-apple-darwin
zip -j ${BIN_NAME}-v${VERSION}-x86_64-mac.zip target/x86_64-apple-darwin/release/${BIN_NAME}

run: ## Cargo run --release
cargo run --release
release: ## Create release
cargo build --locked --release
#zip -j ${BIN_NAME}-v${VERSION}-x86_64-linux.zip target/x86_64-unknown-linux-musl/release/${BIN_NAME}
68 changes: 17 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,53 @@
<p align="center" >
<img src="assets/rust-logo.svg" alt="logo" width="250"/>
<h3 align="center">aws-sso-rs (BETA)</h3>
<p align="center">Get your AWS credentials using SSO</p>
<h3 align="center">aws-sso-auth</h3>
<p align="center">Fetch your local ~/.aws/credentials using AWS SSO</p>
<p align="center">Build with ❤ in Rust</p>
</p>

<p align="center" >
<img alt="GitHub code size in bytes" src="https://img.shields.io/github/languages/code-size/containerscrew/aws-sso-auth">
[![License](https://img.shields.io/github/license/containerscrew/aws-sso-auth)](/LICENSE)
[![codecov](https://codecov.io/gh/containerscrew/aws-sso-auth/branch/main/graph/badge.svg)](https://codecov.io/gh/containerscrew/aws-sso-auth)
[![Release](https://img.shields.io/github/release/containerscrew/aws-sso-rs)](https://github.com/containerscrew/aws-sso-rs/releases/latest)
[![GitHub Releases Stats](https://img.shields.io/github/downloads/containerscrew/aws-sso-auth/total.svg?logo=github)](https://somsubhra.github.io/github-release-stats/?username=containerscrew&repository=aws-sso-auth)
</p>


<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Badges](#badges)
- [Disclaimer](#disclaimer)
- [Pipelines](#pipelines)
- [Introduction](#introduction)
- [Installation](#installation)
- [Pre-commit](#pre-commit)
- [Usage](#usage)
- [Switching accounts](#switching-accounts)
- [Fish shell](#fish-shell)
- [TO DO](#to-do)
- [Developing](#developing)
- [Requirements](#requirements)
- [Clone](#clone)
- [Cargo run](#cargo-run)
- [Build](#build)
- [TO DO (not implemented yet)](#to-do-not-implemented-yet)
- [Contribution](#contribution)
- [LICENSE](#license)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# Badges
# Pipelines
![Test Status](https://github.com/containerscrew/aws-sso-rs/actions/workflows/test.yml/badge.svg)
![Release Status](https://github.com/containerscrew/aws-sso-rs/actions/workflows/release.yml/badge.svg)
[![codecov](https://codecov.io/gh/containerscrew/aws-sso-auth/branch/main/graph/badge.svg)](https://codecov.io/gh/containerscrew/aws-sso-auth)
[![License](https://img.shields.io/github/license/containerscrew/aws-sso-rs)](/LICENSE)
[![Release](https://img.shields.io/github/release/containerscrew/aws-sso-rs)](https://github.com/containerscrew/aws-sso-rs/releases/latest)

# Disclaimer

> I don't have any experience with Rust. I'm not a professional software developer. But, I enjoy trying to create things.
I have some experience in python and Golang. I've only been programming in Rust for 2 weeks and trying to understand the language well. Rust is a new language which I find very interesting and I have fallen in love with it from the first moment, that is why I decided to make this tool in Rust.
Probably this tool is more easy to do in Go or Python, but simple things are boring :)
![Git Leaks Status](https://github.com/containerscrew/aws-sso-auth/actions/workflows/gitleaks.yml/badge.svg)
![Coverage](https://github.com/containerscrew/aws-sso-auth/actions/workflows/coverage.yml/badge.svg)

# Introduction

This tools is just in **BETA** mode. It's working fine and you can download all credentials in your `$HOME/.aws/credentials`. In fact, `this README`is still in progress.
....blablbla

# Installation

TO DO: provide automated pipelines to generate binaries with ARM&AMD binaries to `github releases`. Provide formula for brew mac users, and more!
...TO DO


By the moment, take a look to the **Developing** section below to use this tool locally using **cargo**.

## Pre-commit
[pre-commit](./docs/pre-commit.md)
Expand Down Expand Up @@ -95,41 +91,11 @@ Type `aws-profile` in your terminal, and you will see all the accounts you have
# TO DO

* Logging with env_logger (aws_config it's printing some unnecessary info)
> https://docs.aws.amazon.com/sdk-for-rust/latest/dg/logging.html
> https://github.com/awslabs/aws-sdk-rust/discussions/771
* Code refactoring
* Github actions pipeline to create binary and push to `releases`
* Testing
* Imagine you have 600 accounts with access in your AWS SSO portal, but you only want to fetch 100. How you can limit that?

* Speed credentials download with `async` + `tokio:spawn` threading. The current code is not as fast as I would like.
Avoid this problem: limit number of threads
> thread 'tokio-runtime-worker' panicked at 'Can't get account credentials: TooManyRequestsException(TooManyRequestsException { message: Some("HTTP 429 Unknown Code")
# Developing

## Requirements

* Rust
* Cargo
* Rustup

Take a look to the [official documentation](https://www.rust-lang.org/tools/install)

## Clone

```bash
git clone https://github.com/containerscrew/aws-sso-rs.git
cd aws-sso-rs
```

## Cargo run

```bash
cargo run --start-url https://XXXXXX.awsapps.com/start --region eu-west-1
```

## Build

```bash
Expand Down

0 comments on commit 8101115

Please sign in to comment.