Skip to content

Commit

Permalink
fix(auth): fix Auth0 integration (#164)
Browse files Browse the repository at this point in the history
Because

- `instill auth login` isnt working

This commit

- missing auth0 vars
- .env for local dev
- updated go version
- aligned build system
- aligned CI
- dev and prod tenants working
- fix callback error

Ticket: https://linear.app/instill-ai/issue/INS-1660/cli-fix-auth-for-cloud-prod

### Testing

1. Create an `.env` file and fill in the secrets
```
# SECRETS

# vault / secret / devops / auth0 / prod / client-id
INSTILL_OAUTH_CLIENT_ID=
# vault / secret / devops / auth0 / prod / client-secret
INSTILL_OAUTH_CLIENT_SECRET=

# CONFIG

INSTILL_OAUTH_HOSTNAME=auth.instill.tech
INSTILL_OAUTH_ISSUER=https://auth.instill.tech/
INSTILL_OAUTH_AUDIENCE=https://api.instill.tech
INSTILL_OAUTH_CALLBACK_HOST=localhost
INSTILL_OAUTH_CALLBACK_PORT=8085
```
2. `make bin/instill`
3. `./bin/instill auth login`

### Future work
- integration tests with Auth0
- auth for Core instances

Co-authored-by: Ping-Lin Chang <[email protected]>
  • Loading branch information
TobiaszCudnik and pinglin authored Sep 3, 2023
1 parent 967e8d1 commit d36f340
Show file tree
Hide file tree
Showing 43 changed files with 345 additions and 739 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @pinglin @phelan164 @xiaofei-du
* @TobiaszCudnik @heiruwu @pinglin
133 changes: 0 additions & 133 deletions .github/CODE_OF_CONDUCT.md

This file was deleted.

16 changes: 0 additions & 16 deletions .github/CONTRIBUTING.md

This file was deleted.

21 changes: 21 additions & 0 deletions .github/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2023 Instill AI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
7 changes: 0 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

3 changes: 0 additions & 3 deletions .github/SECURITY.md

This file was deleted.

2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
base:
- "**"
2 changes: 0 additions & 2 deletions .github/semantic.yml

This file was deleted.

91 changes: 0 additions & 91 deletions .github/workflows/add-issue-to-prj.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/add-label-to-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Add PR to Project

on:
pull_request_target:
types:
- opened
- synchronize

jobs:
triage:
uses: instill-ai/.github/.github/workflows/add-label-to-pr.yml@main
secrets:
botGitHubToken: ${{ secrets.botGitHubToken }}
92 changes: 7 additions & 85 deletions .github/workflows/add-pr-to-prj.yml
Original file line number Diff line number Diff line change
@@ -1,92 +1,14 @@
name: Add PR to Project

on:
pull_request:
pull_request_target:
types:
- opened
- ready_for_review

jobs:
track_pr:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Get project data
env:
GITHUB_TOKEN: ${{ secrets.botGitHubToken }}
ORGANIZATION: instill-ai
PROJECT_NUMBER: 5 # Versatile Data Pipeline (VDP) project
run: |
gh api graphql -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectNext(number: $number) {
id
fields(first:20) {
nodes {
id
name
settings
}
}
}
}
}' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
echo 'DATE_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Date posted") | .id' project_data.json) >> $GITHUB_ENV
echo 'STATUS_FIELD_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV
echo 'TODO_OPTION_ID='$(jq '.data.organization.projectNext.fields.nodes[] | select(.name== "Status") |.settings | fromjson.options[] | select(.name=="Todo") |.id' project_data.json) >> $GITHUB_ENV
- name: Add PR to project
env:
GITHUB_TOKEN: ${{ secrets.botGitHubToken }}
PR_ID: ${{ github.event.pull_request.node_id }}
run: |
item_id="$( gh api graphql -f query='
mutation($project:ID!, $pr:ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $pr}) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f pr=$PR_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
echo 'ITEM_ID='$item_id >> $GITHUB_ENV
- name: Get date
run: echo "DATE=$(date +"%Y-%m-%d")" >> $GITHUB_ENV

- name: Set fields
env:
GITHUB_TOKEN: ${{ secrets.botGitHubToken }}
run: |
gh api graphql -f query='
mutation (
$project: ID!
$item: ID!
$status_field: ID!
$status_value: String!
$date_field: ID!
$date_value: String!
) {
set_status: updateProjectNextItemField(input: {
projectId: $project
itemId: $item
fieldId: $status_field
value: $status_value
}) {
projectNextItem {
id
}
}
set_date_posted: updateProjectNextItemField(input: {
projectId: $project
itemId: $item
fieldId: $date_field
value: $date_value
}) {
projectNextItem {
id
}
}
}' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$STATUS_FIELD_ID -f status_value=${{ env.TODO_OPTION_ID }} -f date_field=$DATE_FIELD_ID -f date_value=$DATE --silent
uses: instill-ai/.github/.github/workflows/add-to-prj.yml@main
with:
project_number: 5
secrets:
botGitHubToken: ${{ secrets.botGitHubToken }}
Loading

0 comments on commit d36f340

Please sign in to comment.