Skip to content

Commit

Permalink
Merge pull request #22 from Axway/APIGOV-26149
Browse files Browse the repository at this point in the history
APIGOV-26149 - add gitlab and github jobs/actions
  • Loading branch information
dfeldick authored Nov 8, 2023
2 parents c1cd996 + 3a4eed0 commit 35b2a41
Show file tree
Hide file tree
Showing 17 changed files with 740 additions and 57 deletions.
22 changes: 22 additions & 0 deletions .csr-profile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"project": "Amplify - APIC Kong Agents",
"repo_url": "https://github.com/Axway/agents-kong",
"security_guide": "https://docs.axway.com/bundle/axway_resources/page/amplify_api_management_platform_security_white_paper.html",
"requirements": {
"dependency-check": false,
"fortify": true,
"irius-risk": false,
"npm-audit": false,
"pentest": false,
"retirejs": false,
"twistlock": true,
"zap": false,
"yarn": false,
"gosec": false,
"whitesource": true,
"appspider": false,
"insightvm": false
},
"suppressions": [
]
}
37 changes: 37 additions & 0 deletions .github/workflows/build-discovery-agent-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Kong Discovery Agent Docker
on:
push:
tags:
- v*.*.*

jobs:
build:
env:
GOFLAGS: "-mod=mod"
IMAGE_NAME: kong_discovery_agent
ORG_NAME: Axway
VERSION: ${{ github.ref_name }}
COMMIT_ID: ${{ github.sha }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
flavor: latest=false
images: ghcr.io/${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: build/discovery.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
37 changes: 37 additions & 0 deletions .github/workflows/build-traceability-agent-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Kong Traceability Agent Docker
on:
push:
tags:
- v*.*.*

jobs:
build:
env:
GOFLAGS: "-mod=mod"
IMAGE_NAME: kong_traceability_agent
ORG_NAME: Axway
VERSION: ${{ github.ref_name }}
COMMIT_ID: ${{ github.sha }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
flavor: latest=false
images: ghcr.io/${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: build/traceability.Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
33 changes: 33 additions & 0 deletions .github/workflows/create-tag-for-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This action gets triggered by a closed PR on branch named 'APIGOV-UpdateSDK'
name: Create tag for release

on:
pull_request:
types:
- closed

jobs:
if_SDK_update_merged:
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'APIGOV-UpdateSDK')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Bump tag version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
# by default, this action creates a tag with a 'v' prefix, and bumps the patch version.
# See https://github.com/mathieudutour/github-tag-action to customize these rules.
github_token: ${{ secrets.ACTION_ACCESS_TOKEN }}

- name: Show the new tag
run: |
echo "previous tag ${{ steps.tag_version.outputs.previous_tag }}
echo "new tag ${{ steps.tag_version.outputs.new_tag }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release agents with goreleaser
on:
push:
tags:
- v*.*.*

jobs:
discovery:
runs-on: ubuntu-latest
name: Release discovery
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v3
- name: Unshallow Fetch
run: git fetch --prune --unshallow
- uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Export SDK Version # exports the SDK_VERSION to be used by the goreleaser
run: echo "SDK_VERSION=$(make sdk-version)" >> $GITHUB_ENV
- name: Discovery Release
uses: goreleaser/[email protected]
with:
args: release -f .goreleaser-da.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

traceability:
runs-on: ubuntu-latest
name: Release traceability
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v3
- name: Unshallow Fetch
run: git fetch --prune --unshallow
- uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Export SDK Version # exports the SDK_VERSION to be used by the goreleaser
run: echo "SDK_VERSION=$(make sdk-version)" >> $GITHUB_ENV
- name: Traceability Release
uses: goreleaser/[email protected]
with:
args: release -f .goreleaser-ta.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

notifyTeamsChannel:
needs: [discovery, traceability]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Notify Teams channel
env:
TEAMS_WEBHOOK_URL: ${{ secrets.TEAMS_WEBHOOK_URL }}
TAG: ${{ github.ref_name }}
run: ./release.sh
41 changes: 41 additions & 0 deletions .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build Kong Agents
on:
push:
branches: [main, "APIGOV-*"]

jobs:
test:
env:
GOFLAGS: "-mod=mod"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Test
working-directory: .
run: |
make test
build:
env:
GOFLAGS: "-mod=mod"
VERSION: ${{ github.ref_name }}
COMMIT_ID: ${{ github.sha }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Build discovery agent
working-directory: .
run: |
make build-da
- name: Build traceability agent
working-directory: .
run: |
make build-ta
49 changes: 49 additions & 0 deletions .github/workflows/update-sdk-for-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# this action is triggered by selecting the action in the github UI and then clicking "run workflow"
name: Update SDK version for release

on: workflow_dispatch

jobs:
updateAndCreatePR:
env:
GOFLAGS: "-mod=mod"
GOWORK: "off"
defaults:
run:
working-directory: .
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21

- name: Get latest SDK version
run: |
export LATEST_REMOTE_TAG_CMD="git ls-remote --tags --refs --sort='version:refname' REMOTE_REPO | grep -Eo 'v?[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,3}$' | tail -1"
REMOTE_REPO_PATH="https://github.com/Axway/agent-sdk"
CMD=${LATEST_REMOTE_TAG_CMD/"REMOTE_REPO"/${REMOTE_REPO_PATH}}
export SDK_VERSION=$(eval $CMD)
echo "SDK_VERSION=${SDK_VERSION}" >> $GITHUB_ENV
- name: Update SDK version in go.mod
working-directory: .
run: |
echo "SDK_VERSION is ${{ env.SDK_VERSION }}"
make dep-version sdk=${{ env.SDK_VERSION }}
- name: Create Pull Request
id: cpr
uses: peter-evans/[email protected]
with:
branch: APIGOV-UpdateSDK
commit-message: 'Update to SDK ${{ env.SDK_VERSION }}'
title: 'APIGOV-UpdateSDK - Update to SDK ${{ env.SDK_VERSION }}'
delete-branch: true
reviewers: dfeldick

- name: Enable Pull Request Automerge
run: gh pr merge APIGOV-UpdateSDK --admin --merge --subject "Merge branch APIGOV-UpdateSDK"
env:
GH_TOKEN: ${{ secrets.ACTION_ACCESS_TOKEN }}
Loading

0 comments on commit 35b2a41

Please sign in to comment.