Skip to content

Commit

Permalink
Merge pull request #49 from daystram/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
daystram authored Jul 13, 2021
2 parents 68963fe + 30070ad commit abe4914
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 32 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ on:
jobs:
image:
name: Publish Image
environment: Development
runs-on: Ubuntu-20.04
env:
APPLICATION: ratify
strategy:
matrix:
app: [be, fe]
service: [be, fe]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
Expand All @@ -24,18 +27,23 @@ jobs:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set Development Version
run: echo "RELEASE_VERSION=dev" >> $GITHUB_ENV
- name: Provide Env File
run: echo "${{ secrets.FE_ENV_FILE }}" > ${{ env.APPLICATION }}-${{ matrix.service }}/.env.production
- name: Build and Push Image
uses: docker/build-push-action@v2
with:
context: folio-${{ matrix.app }}
context: ${{ env.APPLICATION }}-${{ matrix.service }}
platforms: linux/amd64
tags: daystram/folio:${{ matrix.app }}-${{ env.RELEASE_VERSION }}
tags: daystram/${{ env.APPLICATION }}:${{ matrix.service }}-${{ env.RELEASE_VERSION }}
push: true
chart:
name: Publish Helm Chart
environment: Development
runs-on: Ubuntu-20.04
container: daystram/k8s-tools:latest
needs: [image]
env:
APPLICATION: ratify
steps:
- name: Checkout Repository
uses: actions/checkout@v2
Expand All @@ -60,8 +68,8 @@ jobs:
git clone ssh://[email protected]/daystram/helm-charts.git
cp -r .daystram helm-charts/docs/
cd helm-charts/docs/
curl -sfL https://charts.daystram.com/build.sh | sh -s - folio ${{ env.RELEASE_VERSION }}
curl -sfL https://charts.daystram.com/build.sh | sh -s - ${{ env.APPLICATION }} ${{ env.RELEASE_VERSION }}
rm -rf .daystram/
git add .
git commit -m "feat: added chart for folio@${{ env.RELEASE_VERSION }}"
git commit -m "feat: added chart for ${{ env.APPLICATION }}@${{ env.RELEASE_VERSION }}"
git push
2 changes: 0 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ jobs:
node-version: 12.x
- name: Install Dependencies
run: yarn install
- name: Provide Env File
run: echo $FE_ENV_FILE > .env.production
- name: Build
run: yarn build
- name: Archive Artifacts
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ on:
jobs:
image:
name: Publish Image
environment: Production
runs-on: Ubuntu-20.04
env:
APPLICATION: ratify
strategy:
matrix:
app: [be, fe]
Expand All @@ -26,20 +29,25 @@ jobs:
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get Release Version
run: echo "RELEASE_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Provide Env File
run: echo "${{ secrets.FE_ENV_FILE }}" > ${{ env.APPLICATION }}-${{ matrix.service }}/.env.production
- name: Build and Push Image
uses: docker/build-push-action@v2
with:
context: folio-${{ matrix.app }}
context: ${{ env.APPLICATION }}-${{ matrix.service }}
platforms: linux/amd64
tags: |
daystram/folio:${{ matrix.app }}
daystram/folio:${{ matrix.app }}-${{ env.RELEASE_VERSION }}
daystram/${{ env.APPLICATION }}:${{ matrix.service }}
daystram/${{ env.APPLICATION }}:${{ matrix.service }}-${{ env.RELEASE_VERSION }}
push: true
chart:
name: Publish Helm Chart
environment: Production
runs-on: Ubuntu-20.04
container: daystram/k8s-tools:latest
needs: [image]
env:
APPLICATION: ratify
steps:
- name: Checkout Repository
uses: actions/checkout@v2
Expand All @@ -64,8 +72,8 @@ jobs:
git clone ssh://[email protected]/daystram/helm-charts.git
cp -r .daystram helm-charts/docs/
cd helm-charts/docs/
curl -sfL https://charts.daystram.com/build.sh | sh -s - folio ${{ env.RELEASE_VERSION }}
curl -sfL https://charts.daystram.com/build.sh | sh -s - ${{ env.APPLICATION }} ${{ env.RELEASE_VERSION }}
rm -rf .daystram/
git add .
git commit -m "feat: added chart for folio@${{ env.RELEASE_VERSION }}"
git commit -m "feat: added chart for ${{ env.APPLICATION }}@${{ env.RELEASE_VERSION }}"
git push
28 changes: 16 additions & 12 deletions ratify-fe/src/utils/url.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
export function validateURL(
urlString: string,
allowInsecure?: boolean,
allowLocalhost?: boolean
): boolean {
const url = new URL(urlString);
return (
((url.protocol === "http:" && allowInsecure) ||
url.protocol === "https:") &&
(url.hostname !== "localhost" || !!allowLocalhost) &&
url.origin !== null
);
function validate(urlString: string, allowInsecure?: boolean): boolean {
try {
const url = new URL(urlString);
const regex = /^([-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,})$|^(localhost)$/;
return (
((url.protocol === "http:" && allowInsecure) ||
url.protocol === "https:") &&
regex.test(url.hostname) &&
url.origin !== null
);
} catch (e) {
return false;
}
}

export const validateURL = (allowInsecure?: boolean) => (urlString: string) =>
validate(urlString, allowInsecure);
11 changes: 6 additions & 5 deletions ratify-fe/src/views/manage/application/ApplicationDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,10 @@

<script lang="ts">
import Vue from "vue";
import { STATUS } from "@/constants/status";
import api from "@/apis/api";
import { maxLength, required, url } from "vuelidate/lib/validators";
import { STATUS } from "@/constants/status";
import { validateURL } from "@/utils/url";
import { maxLength, required } from "vuelidate/lib/validators";
export default Vue.extend({
data: () => ({
Expand Down Expand Up @@ -638,9 +639,9 @@ export default Vue.extend({
detail: {
name: { required, maxLength: maxLength(20) },
description: { required, maxLength: maxLength(50) },
loginURL: { required, url },
callbackURL: { required, url },
logoutURL: { required, url }
loginURL: { required, url: validateURL(true) },
callbackURL: { required, url: validateURL(true) },
logoutURL: { required, url: validateURL(true) }
}
},
Expand Down
6 changes: 3 additions & 3 deletions ratify-fe/src/views/manage/application/ApplicationList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ export default Vue.extend({
create: {
name: { required, maxLength: maxLength(20) },
description: { required, maxLength: maxLength(50) },
loginURL: { required, url: validateURL },
callbackURL: { required, url: validateURL },
logoutURL: { required, url: validateURL }
loginURL: { required, url: validateURL(true) },
callbackURL: { required, url: validateURL(true) },
logoutURL: { required, url: validateURL(true) }
}
},
Expand Down

0 comments on commit abe4914

Please sign in to comment.