Merge pull request #10 from philips-forks/refator-pipeline

Refator pipeline
This commit is contained in:
aswin-in-philips 2022-05-10 00:01:12 +05:30 committed by GitHub
commit b89ad59821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 176 additions and 76 deletions

View File

@ -1,6 +1,6 @@
[bumpversion]
current_version = 1.0.7
current_version = 1.0.11
commit = False
tag = False
[bumpversion:file:VERSION]
[bumpversion:file:VERSION]

View File

@ -0,0 +1,35 @@
name: API-GW-INTEGRATED-TEST
on:
workflow_call:
secrets:
VAULT_HOST:
required: true
VAULT_ROLE_ID:
required: true
VAULT_SECRET_ID:
required: true
jobs:
Deploy:
runs-on: ubuntu-20.04
steps:
- name: Import Secrets
id: secrets
uses: hashicorp/vault-action@v2.3.1
with:
url: ${{ secrets.VAULT_HOST }}
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
exportEnv: true
secrets: |
devops/data/github/users/sal-devops token | GITHUB_TOKEN ;
- uses: convictional/trigger-workflow-and-wait@v1.6.1
with:
owner: philips-internal
repo: hds-auth-gateway
github_token: ${{ env.GITHUB_TOKEN }}
workflow_file_name: cd.yaml
ref: terraform

View File

@ -5,10 +5,41 @@ on:
branches:
- 'edi-foundation-integration'
# - $default-branch
workflow_dispatch:
paths-ignore:
- 'VERSION'
- '.bumpversion.cfg'
pull_request:
branches: [ edi-foundation-integration ]
workflow_dispatch:
jobs:
Init:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.ADMIN_TOKEN }}
- name: Extract branch name
uses: vazco/github-actions-branch-name@v1
id: branch
- name: Bump version
if: github.ref == 'refs/heads/edi-foundation-integration'
run: |
sudo apt update
sudo apt install bumpversion
bumpversion patch
new_version=`cat VERSION`
echo "New version is: $new_version"
git config --global user.name "CI Build"
git config --global user.email "ci.build@philips.com"
git commit -am "Bump version $new_version"
git push --force
unit-test:
needs: [Init]
env:
COVER: true
runs-on: ubuntu-20.04
@ -47,12 +78,60 @@ jobs:
run: |
./.github/workflows/test.sh
docker:
Blackduck:
needs: [Init]
runs-on: builder_blr
steps:
- name: checkout
uses: actions/checkout@v2
- name: blackduck scan
run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\Build\PS\Invoke-BlackduckDetect.ps1 -SourcePath ${{ github.workspace }}
Fortify:
needs: [Init]
runs-on: builder_blr
steps:
- name: checkout
uses: actions/checkout@v2
- name: Fortify scan
run: powershell -ExecutionPolicy RemoteSigned -NoExit -File ${{ github.workspace }}\build\ps\Invoke-FortifyScan.ps1
Build:
needs: [Init]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Check out code
uses: actions/checkout@v2
- name: Import Secrets
id: secrets
uses: hashicorp/vault-action@v2.3.1
with:
url: ${{ secrets.VAULT_HOST }}
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
exportEnv: true
secrets: |
devops/data/docker-repos/hsdp-edi endPoint | HSDP_DOCKER_REGISTRY ;
devops/data/docker-repos/hsdp-edi user | HSDP_DOCKER_USER ;
devops/data/docker-repos/hsdp-edi password | HSDP_DOCKER_PASSWORD ;
devops/data/github/users/sal-devops token | GITHUB_TOKEN ;
- name: Extract branch name
uses: vazco/github-actions-branch-name@v1
id: branch
- name: Set env variables
run: |
new_version=`cat VERSION`
echo "New version is: $new_version"
echo "VERSION=$new_version" >> "$GITHUB_ENV"
echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:${new_version}-alpha" >> "$GITHUB_ENV"
echo "CI_LATEST_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:latest" >> "$GITHUB_ENV"
echo "BRANCH_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:${{ steps.branch.outputs.branch_name }}-${new_version}" >> "$GITHUB_ENV"
echo "RC_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:${new_version}-rc" >> "$GITHUB_ENV"
- name: Docker Build
run: |
@ -62,9 +141,59 @@ jobs:
run: |
docker login --username '${{ secrets.DOCKER_USER }}' --password '${{ secrets.DOCKER_PSWD }}' '${{ secrets.DOCKER_REPO }}'
- name: Docker tag & Push
- name: Docker tag
run: |
docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:${{ github.sha }}
docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:latest
docker push '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:${{ github.sha }}
docker push '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:latest
docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest ${{ env.BRANCH_IMAGE }}
docker push ${{ env.BRANCH_IMAGE }}
- name: Docker Push
if: github.ref == 'refs/heads/edi-foundation-integration'
run: |
docker tag ${{ env.BRANCH_IMAGE }} ${{ env.CI_IMAGE }}
docker push ${{ env.CI_IMAGE }}
Deploy_And_GW_Integrated_Test:
needs: [Build, Blackduck, Fortify, unit-test]
if: github.ref == 'refs/heads/edi-foundation-integration'
uses: ./.github/workflows/api-gw-integrated-test.yaml
secrets:
VAULT_HOST: ${{ secrets.VAULT_HOST }}
VAULT_ROLE_ID: ${{ secrets.VAULT_ROLE_ID }}
VAULT_SECRET_ID: ${{ secrets.VAULT_SECRET_ID }}
Release:
if: github.ref == 'refs/heads/edi-foundation-integration'
needs: Deploy_And_GW_Integrated_Test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Import Secrets
id: secrets
uses: hashicorp/vault-action@v2.3.1
with:
url: ${{ secrets.VAULT_HOST }}
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
exportEnv: true
secrets: |
devops/data/docker-repos/hsdp-edi endPoint | HSDP_DOCKER_REGISTRY ;
devops/data/docker-repos/hsdp-edi user | HSDP_DOCKER_USER ;
devops/data/docker-repos/hsdp-edi password | HSDP_DOCKER_PASSWORD ;
- name: Set env variables
run: |
new_version=`cat VERSION`
echo "CI_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:${new_version}-alpha" >> "$GITHUB_ENV"
echo "CI_LATEST_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:latest" >> "$GITHUB_ENV"
echo "RC_IMAGE=${{ env.HSDP_DOCKER_REGISTRY }}/edi/edi-foundation-oauth2-proxy:${new_version}-rc" >> "$GITHUB_ENV"
- name: Login to Docker Repo
run: docker login ${{ env.HSDP_DOCKER_REGISTRY }} --username ${{ env.HSDP_DOCKER_USER }} --password ${{ env.HSDP_DOCKER_PASSWORD }}
- name: Docker Push
run: |
docker pull ${{ env.CI_IMAGE }}
docker tag ${{ env.CI_IMAGE }} ${{ env.RC_IMAGE }}
docker push ${{ env.RC_IMAGE }}

View File

@ -1,64 +0,0 @@
name: PR
on:
pull_request:
branches:
- 'edi-foundation-integration'
# - $default-branch
jobs:
build:
env:
COVER: true
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Go 1.16
uses: actions/setup-go@v2
with:
go-version: 1.16.x
id: go
- name: Get dependencies
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.36.0
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- name: Verify Code Generation
run: |
make verify-generate
- name: Lint
run: |
make lint
- name: Build
run: |
make build
- name: Test
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
./.github/workflows/test.sh
docker:
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Docker Build
run: |
make docker
- name: Docker login
run: |
docker login --username '${{ secrets.DOCKER_USER }}' --password '${{ secrets.DOCKER_PSWD }}' '${{ secrets.DOCKER_REPO }}'
- name: Docker tag & Push
run: |
docker tag '${{ secrets.DOCKER_REPO }}'/oauth2-proxy:latest '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:prlatest
docker push '${{ secrets.DOCKER_REPO }}'/edi-foundation-oauth2-proxy:prlatest

View File

@ -1 +1 @@
1.0.7
1.0.11