Skip to content

Commit

Permalink
Merge pull request #365 from tawoe/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
simonredfern authored Nov 5, 2024
2 parents 661c9b8 + add2080 commit 3b47788
Show file tree
Hide file tree
Showing 53 changed files with 263 additions and 183 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
17 changes: 10 additions & 7 deletions .github/workflows/build_container_image.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: build and publish container
name: build and publish container develop branch

on: [push]
on:
push:
branches:
- develop
env:
DOCKER_HUB_ORGANIZATION: ${{ vars.DOCKER_HUB_ORGANIZATION }}
DOCKER_HUB_REPOSITORY_NGINX: apimanager-nginx
Expand All @@ -17,20 +20,20 @@ jobs:
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch

- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Build the Docker image
run: |
echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io
docker build . --file .github/Dockerfile_nginx_OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:${{ steps.extract_branch.outputs.branch }}-OC
docker build . --file .github/Dockerfile_nginx_OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:${{ steps.extract_branch.outputs.branch }}-OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:latest-OC
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }} --all-tags
echo docker apimanager-nginx-OC done
docker build . --file .github/Dockerfile_OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ steps.extract_branch.outputs.branch }}-OC
docker build . --file .github/Dockerfile_OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ steps.extract_branch.outputs.branch }}-OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:latest-OC
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }} --all-tags
echo docker api-manager-OC done
docker build . --file Dockerfile_nginx --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:${{ steps.extract_branch.outputs.branch }}
docker build . --file Dockerfile_nginx --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:${{ steps.extract_branch.outputs.branch }} --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:latest
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }} --all-tags
echo docker apimanager-nginx done
docker build . --file Dockerfile --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ steps.extract_branch.outputs.branch }}
docker build . --file Dockerfile --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ steps.extract_branch.outputs.branch }} --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:latest
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }} --all-tags
echo docker api-manager done
- uses: sigstore/cosign-installer@main
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/build_container_image_non_develop_branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: build and publish container non develop branches

on:
push:
branches:
- '*'
- '!develop'
env:
DOCKER_HUB_ORGANIZATION: ${{ vars.DOCKER_HUB_ORGANIZATION }}
DOCKER_HUB_REPOSITORY_NGINX: apimanager-nginx
DOCKER_HUB_REPOSITORY: api-manager


jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Extract branch name
shell: bash
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
id: extract_branch

- uses: actions/checkout@v4
- name: Build the Docker image
run: |
echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io
docker build . --file .github/Dockerfile_nginx_OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:${{ steps.extract_branch.outputs.branch }}-OC
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }} --all-tags
echo docker apimanager-nginx-OC done
docker build . --file .github/Dockerfile_OC --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ steps.extract_branch.outputs.branch }}-OC
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }} --all-tags
echo docker api-manager-OC done
docker build . --file Dockerfile_nginx --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:${{ steps.extract_branch.outputs.branch }}
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }} --all-tags
echo docker apimanager-nginx done
docker build . --file Dockerfile --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ steps.extract_branch.outputs.branch }}
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }} --all-tags
echo docker api-manager done
- uses: sigstore/cosign-installer@main
- name: Write signing key to disk (only needed for `cosign sign --key`)
run: echo "${{ secrets.COSIGN_PRIVATE_KEY }}" > cosign.key
- name: Sign container image with annotations from our environment
env:
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
run: |
cosign sign -y --key cosign.key \
-a "repo=${{ github.repository }}" \
-a "workflow=${{ github.workflow }}" \
-a "ref=${{ github.sha }}" \
docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ steps.extract_branch.outputs.branch }}-OC
cosign sign -y --key cosign.key \
-a "repo=${{ github.repository }}" \
-a "workflow=${{ github.workflow }}" \
-a "ref=${{ github.sha }}-nginx" \
docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:${{ steps.extract_branch.outputs.branch }}-OC
cosign sign -y --key cosign.key \
-a "repo=${{ github.repository }}" \
-a "workflow=${{ github.workflow }}" \
-a "ref=${{ github.sha }}" \
docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:${{ steps.extract_branch.outputs.branch }}
cosign sign -y --key cosign.key \
-a "repo=${{ github.repository }}" \
-a "workflow=${{ github.workflow }}" \
-a "ref=${{ github.sha }}-nginx" \
docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY_NGINX }}:${{ steps.extract_branch.outputs.branch }}
6 changes: 2 additions & 4 deletions .github/workflows/run_trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: scan container image

on:
workflow_run:
workflows: [build and publish container]
types:
- completed
workflows: [build and publish container develop branch, build and publish container non develop branches]
types: [completed]
env:
## Sets environment variable
DOCKER_HUB_ORGANIZATION: ${{ vars.DOCKER_HUB_ORGANIZATION }}
Expand Down Expand Up @@ -40,7 +39,6 @@ jobs:
format: 'template'
template: '@/contrib/sarif.tpl'
output: 'trivy-results.sarif'
security-checks: 'vuln'
severity: 'CRITICAL,HIGH'
timeout: '30m'
cache-dir: .trivy
Expand Down
2 changes: 1 addition & 1 deletion apimanager/accountlist/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class AccountConfig(AppConfig):
name = 'account-list'
name = 'accountlist'
6 changes: 3 additions & 3 deletions apimanager/accountlist/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
URLs for Account list app
"""

from django.conf.urls import url
from django.urls import re_path
from .views import AccountListView, ExportCsvView

urlpatterns = [
url(r'^$',
re_path(r'^$',
AccountListView.as_view(),
name='account-list'),
url(r'^export_csv$',
re_path(r'^export_csv$',
ExportCsvView.as_view(),
name='export-csv-account')
]
2 changes: 1 addition & 1 deletion apimanager/accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from django import forms
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

import random

Expand Down
4 changes: 2 additions & 2 deletions apimanager/accounts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
URLs for Account app
"""

from django.conf.urls import url
from django.urls import re_path
from .views import IndexAccountsView

urlpatterns = [
url(r'^create',
re_path(r'^create',
IndexAccountsView.as_view(),
name='accounts-create'),

Expand Down
2 changes: 1 addition & 1 deletion apimanager/accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from django.views.generic import FormView
from obp.api import API, APIError
from .forms import CreateAccountForm
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

class IndexAccountsView(LoginRequiredMixin, FormView):

Expand Down
4 changes: 2 additions & 2 deletions apimanager/apicollectionlist/apps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.apps import AppConfig


class CustomersConfig(AppConfig):
name = 'customers_list'
class ApiCollectionListConfig(AppConfig):
name = 'apicollectionlist'
6 changes: 3 additions & 3 deletions apimanager/apicollectionlist/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
URLs for Api Collection list app
"""

from django.conf.urls import url
from django.urls import re_path
from .views import ApiCollectionListView, ExportCsvView

urlpatterns = [
url(r'^$',
re_path(r'^$',
ApiCollectionListView.as_view(),
name='apicollection-list'),
url(r'^export_csv$',
re_path(r'^export_csv$',
ExportCsvView.as_view(),
name='export-csv-apicollection')
]
17 changes: 7 additions & 10 deletions apimanager/apicollections/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,25 @@
URLs for config app
"""

from django.conf.urls import url
from django.urls import re_path

from apicollections.views import IndexView, apicollections_save, \
apicollections_delete, DetailView, DeleteCollectionEndpointView, apicollections_update

urlpatterns = [
url(r'^$',
re_path(r'^$',
IndexView.as_view(),
name='apicollections-index'),
url(r'save/apicollection', apicollections_save,
re_path(r'save/apicollection', apicollections_save,
name='apicollection-save'),
url(r'update/apicollection', apicollections_update,
re_path(r'update/apicollection', apicollections_update,
name='apicollection-update'),
url(r'delete/apicollection', apicollections_delete,
re_path(r'delete/apicollection', apicollections_delete,
name='apicollection-delete'),
url(r'^my-api-collection-ids/(?P<api_collection_id>[\w\@\.\+-]+)$',
re_path(r'^my-api-collection-ids/(?P<api_collection_id>[\w\@\.\+-]+)$',
DetailView.as_view(),
name='my-api-collection-detail'),
url(r'^delete/api-collections/(?P<api_collection_id>[\w-]+)/api-collection-endpoint/(?P<operation_id>[\w\@\.\+-]+)$',
re_path(r'^delete/api-collections/(?P<api_collection_id>[\w-]+)/api-collection-endpoint/(?P<operation_id>[\w\@\.\+-]+)$',
DeleteCollectionEndpointView.as_view(),
name='delete-api-collection-endpoint'),
# url(r'^add/api-collections/(?P<api_collection_id>[\w-]+)/api-collection-endpoints/(?P<operation_id>[\w\@\.\+-]+)$',
# AddCollectionEndpointView.as_view(),
# name='add-api-collection-endpoint'),
]
2 changes: 1 addition & 1 deletion apimanager/apimanager/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'bootstrap3',
'bootstrap',
'bootstrap_datepicker_plus',
'mathfilters',
'base',
Expand Down
62 changes: 31 additions & 31 deletions apimanager/apimanager/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
URLs for apimanager
"""

from django.conf.urls import url, include
from django.urls import re_path, include
from django.conf.urls.i18n import i18n_patterns

from base.views import HomeView
Expand All @@ -16,46 +16,46 @@

urlpatterns = [
#These pages URLs have no GUI
url(r'^oauth/initiate$',
re_path(r'^oauth/initiate$',
OAuthInitiateView.as_view(), name='oauth-initiate'),
url(r'^oauth/authorize$',
re_path(r'^oauth/authorize$',
OAuthAuthorizeView.as_view(), name='oauth-authorize'),
url(r'^directlogin$',
re_path(r'^directlogin$',
DirectLoginView.as_view(), name='directlogin'),
url(r'^gatewaylogin$',
re_path(r'^gatewaylogin$',
GatewayLoginView.as_view(), name='gatewaylogin'),
# Defining authentication URLs here and not including oauth.urls for
# backward compatibility
]
urlpatterns += i18n_patterns(
#urlpatterns = (
url(r'^$', HomeView.as_view(), name="home"),
url(r'^single-sign-on',
re_path(r'^$', HomeView.as_view(), name="home"),
re_path(r'^single-sign-on',
OAuthInitiateView.as_view(), name='single-sign-on'),
url(r'^logout$', LogoutView.as_view(), name='oauth-logout'),
url(r'^systemviews/', include('systemviews.urls')),
url(r'^accounts/', include('accounts.urls')),
url(r'^account/list', include('accountlist.urls')),
url(r'^consumers/', include('consumers.urls')),
url(r'^entitlementrequests/', include('entitlementrequests.urls')),
url(r'^users/', include('users.urls')),
url(r'^branches/', include('branches.urls')),
url(r'^atms/', include('atms.urls')),
url(r'^atms/list', include('atmlist.urls')),
url(r'^banks/', include('banks.urls')),
url(r'^banks/list', include('banklist.urls')),
url(r'^products/', include('products.urls')),
url(r'^products/list', include('productlist.urls')),
url(r'^customers/', include('customers.urls')),
url(r'^customer/list', include('customerlist.urls')),
url(r'^metrics/', include('metrics.urls')),
url(r'^config/', include('config.urls')),
url(r'^webui/', include('webui.urls')),
url(r'^methodrouting/', include('methodrouting.urls')),
url(r'^connectormethod/', include('connectormethod.urls')),
url(r'^dynamicendpoints/', include('dynamicendpoints.urls')),
url(r'^apicollections/', include('apicollections.urls')),
url(r'^apicollections-list', include('apicollectionlist.urls')),
re_path(r'^logout$', LogoutView.as_view(), name='oauth-logout'),
re_path(r'^systemviews/', include('systemviews.urls')),
re_path(r'^accounts/', include('accounts.urls')),
re_path(r'^account/list', include('accountlist.urls')),
re_path(r'^consumers/', include('consumers.urls')),
re_path(r'^entitlementrequests/', include('entitlementrequests.urls')),
re_path(r'^users/', include('users.urls')),
re_path(r'^branches/', include('branches.urls')),
re_path(r'^atms/', include('atms.urls')),
re_path(r'^atms/list', include('atmlist.urls')),
re_path(r'^banks/', include('banks.urls')),
re_path(r'^banks/list', include('banklist.urls')),
re_path(r'^products/', include('products.urls')),
re_path(r'^products/list', include('productlist.urls')),
re_path(r'^customers/', include('customers.urls')),
re_path(r'^customer/list', include('customerlist.urls')),
re_path(r'^metrics/', include('metrics.urls')),
re_path(r'^config/', include('config.urls')),
re_path(r'^webui/', include('webui.urls')),
re_path(r'^methodrouting/', include('methodrouting.urls')),
re_path(r'^connectormethod/', include('connectormethod.urls')),
re_path(r'^dynamicendpoints/', include('dynamicendpoints.urls')),
re_path(r'^apicollections/', include('apicollections.urls')),
re_path(r'^apicollections-list', include('apicollectionlist.urls')),
)
#prefix_default_language=False,
#)+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
2 changes: 1 addition & 1 deletion apimanager/atmlist/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class AtmsConfig(AppConfig):
name = 'atms_list'
name = 'atmlist'
6 changes: 3 additions & 3 deletions apimanager/atmlist/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
URLs for ATM list app
"""

from django.conf.urls import url
from django.urls import re_path
from .views import AtmListView, ExportCsvView

urlpatterns = [
url(r'^$',
re_path(r'^$',
AtmListView.as_view(),
name='atm-list'),
url(r'^export_csv$',
re_path(r'^export_csv$',
ExportCsvView.as_view(),
name='export-csv')
]
2 changes: 1 addition & 1 deletion apimanager/atms/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

from django import forms
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

import random

Expand Down
Loading

0 comments on commit 3b47788

Please sign in to comment.