Skip to content

Commit

Permalink
Fix CICD build jobs and Updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
piyushsonigra committed Feb 6, 2022
1 parent 0012d0e commit 373591d
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 60 deletions.
43 changes: 0 additions & 43 deletions .circleci/config.yml

This file was deleted.

68 changes: 57 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ jobs:
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Save Upload URL
shell: bash
run: |
echo "${{ steps.create_release.outputs.upload_url }}" > upload-url.txt
run: echo "${{ steps.create_release.outputs.upload_url }}" > upload-url.txt

- name: Upload
uses: actions/upload-artifact@v1
Expand All @@ -39,28 +37,30 @@ jobs:
python-version: [3.7]
steps:
- uses: actions/checkout@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build App
run: |
make build
run: make build

- name: Package App
run: |
PLATFORM=osx_x64 make package
run: PLATFORM=osx_x64 make package

- name: Download Upload URL
uses: actions/download-artifact@v1
with:
name: uploadurl

- name: Extract Upload URL
shell: bash
run: |
echo "##[set-output name=upload_url;] $(cat uploadurl/upload-url.txt)"
run: echo "##[set-output name=upload_url;] $(cat uploadurl/upload-url.txt)"
id: extract_upload_url

- name: Upload Release Asset - OSx
Expand All @@ -73,3 +73,49 @@ jobs:
asset_path: dist/aws_ipadd_osx_x64.tar.gz
asset_name: aws_ipadd_osx_x64.tar.gz
asset_content_type: application/octet-stream

build_release_linux:
needs: create_release
runs-on: ubuntu-18.04
strategy:
max-parallel: 4
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v1

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build App
run: make build

- name: Package App
run: PLATFORM=linux_x64 make package

- name: Download Upload URL
uses: actions/download-artifact@v1
with:
name: uploadurl

- name: Extract Upload URL
run: echo "##[set-output name=upload_url;] $(cat uploadurl/upload-url.txt)"
id: extract_upload_url

- name: Upload Release Asset - Linux
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.extract_upload_url.outputs.upload_url }}
asset_path: dist/aws_ipadd_linux_x64.tar.gz
asset_name: aws_ipadd_linux_x64.tar.gz
asset_content_type: application/octet-stream
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ Run below commands to conifgure aws_ipadd command.
Create directory `~/.aws_ipadd` at your home directory.

```console
$ mkdir ~/.aws_ipadd
mkdir ~/.aws_ipadd
```

Create configuration file `aws_ipadd` inside `~/.aws_ipadd`.

```console
$ touch ~/.aws_ipadd/aws_ipadd
touch ~/.aws_ipadd/aws_ipadd
```

Edit the `~/.aws_ipadd/aws_ipadd` file and add below Informations as shown in sample configuration file. You can also checkout the config-example.txt file in the project for multi profile configuration.
Expand All @@ -65,7 +65,7 @@ Run below commands to conifgure aws_ipadd command.
AWS security group rule name to identify rule purpose.

- protocol:
You can define protocol for port TCP or UDP. Default is TCP.
Port protocol name i.e TCP, UDP or valid port protocol that security group accept.

- port:
Network port to whitelist with IP.
Expand Down Expand Up @@ -104,17 +104,20 @@ Run the aws_ipadd command with aws_ipadd profile.

```console
$ aws_ipadd my_project_ssh
---------------
my_project_ssh
---------------
Modifying existing rule...
Removing old whitelisted IP '12.10.1.14/32'.
Whitelisting new IP '131.4.10.16/32'.
Rule successfully updated!
```

You can also configure cronjob to check and keep whitelisted your Public IP in security groups.
You can also configure cronjob to check and keep whitelisted your Public IP in one or more security groups.

```console
# Run every hour
$ * */1 * * * /usr/local/bin/aws_ipadd project_ssh project_rdp
* */1 * * * /usr/local/bin/aws_ipadd project_ssh project_rdp
```

### Feature Update
Expand Down
2 changes: 1 addition & 1 deletion aws_ipadd
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ for profile_name in args.profile_names:
config = config[profile_name]
rule_name = config['rule_name']
port = int(config['port'])
protocol = config['protocol'] or 'tcp'
protocol = config['protocol']
security_group_id = config['security_group_id']
aws_profile = config['aws_profile']
region_name = config['region_name']
Expand Down

0 comments on commit 373591d

Please sign in to comment.