Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add prd pipelines #41

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .github/workflows/scv-gw-prd-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Production Scv Gateway pipelines

on:
push:
branches:
- main

env:
ENV: "prd"
APP: "scv-gateway"

concurrency: scv_production_environment

jobs:
main:
runs-on: ubuntu-latest
name: Production Scv Gateway pipelines
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
ref: ${{ github.event.pull_request.head.sha }}

- name: Get tags
run: git fetch --tags origin

- name: Get latest release tag
shell: bash
id: release_tag
run: echo TAG=$(git describe --tags HEAD --abbrev=0) >> $GITHUB_OUTPUT

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
with:
install: true

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ env.ENV }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.ENV }}-buildx

- name: Log in to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Extract metadata for docker
if: |
github.event_name == 'push' ||
startsWith(github.ref, 'refs/tags/v')
id: meta
uses: docker/metadata-action@v3
with:
images: aeternity/smart-contract-verifier
tags: |
type=raw,value=${{ steps.release_tag.outputs.TAG }}

- name: Build and push docker image
if: github.event_name == 'push'
uses: docker/build-push-action@v2
with:
context: .
file: ./apps/scv-gateway/dev/Dockerfile
push: true
target: prod
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

- name: Move cache
if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'synchronize'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

- uses: actions/checkout@v2
with:
repository: aeternity/gitops-apps-aelabs.git
ref: prd
token: ${{ secrets.BOT_GITHUB_TOKEN }}
persist-credentials: false
fetch-depth: 0

- name: Production Deploy
uses: aeternity/ae-github-actions/argocd-deploy@v4
with:
git-sha: ${{ steps.git-sha.outputs.GIT_SHA }}
url-prefix: ${{ steps.release_tag.outputs.TAG }}
env: ${{ env.ENV }}
app: ${{ env.APP }}

- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: aeternity/gitops-apps-aelabs
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
branch: prd
102 changes: 102 additions & 0 deletions .github/workflows/testnet-scv-gw-prd-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Production Scv Gateway Testnet pipelines

on:
push:
branches:
- main

env:
ENV: "prd"
APP: "scv-gateway-testnet"

concurrency: testnet_scv_production_environment

jobs:
main:
runs-on: ubuntu-latest
name: Production Pipeline Scv Gateway Testnet
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get tags
run: git fetch --tags origin

- name: Get latest release tag
shell: bash
id: release_tag
run: echo TAG=$(git describe --tags HEAD --abbrev=0) >> $GITHUB_OUTPUT

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
# Only worked for us with this option on
with:
install: true

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
# Key is named differently to avoid collision
key: ${{ runner.os }}-${{ env.ENV }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.ENV }}-buildx

- name: Log in to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Extract metadata for docker
if: github.event_name == 'push'
id: meta
uses: docker/metadata-action@v3
with:
images: aeternity/smart-contract-verifier
tags: |
type=raw,value=${{ steps.release_tag.outputs.TAG }}

- name: Build and push docker image
if: github.event_name == 'push'
uses: docker/build-push-action@v2
with:
context: .
file: ./apps/scv-gateway/dev/Dockerfile
push: true
target: prod
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

- name: Move cache
if: github.event_name == 'push'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

- uses: actions/checkout@v2
with:
repository: aeternity/gitops-apps-aelabs.git
ref: prd
token: ${{ secrets.BOT_GITHUB_TOKEN }}
persist-credentials: false
fetch-depth: 0

- name: Production Deploy
uses: aeternity/ae-github-actions/argocd-deploy@v4
with:
git-sha: ${{ steps.git-sha.outputs.GIT_SHA }}
url-prefix: ${{ steps.release_tag.outputs.TAG }}
env: ${{ env.ENV }}
app: ${{ env.APP }}

- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: aeternity/gitops-apps-aelabs
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
branch: prd
102 changes: 102 additions & 0 deletions .github/workflows/testnet-worker-prod-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Production Scv Worker pipelines

on:
push:
branches:
- main

env:
ENV: "prd"
APP: "scv-worker-testnet"

concurrency: testnet_scv_production_environment

jobs:
main:
runs-on: ubuntu-latest
name: Production Pipeline Scv Worker
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get tags
run: git fetch --tags origin

- name: Get latest release tag
shell: bash
id: release_tag
run: echo TAG=$(git describe --tags HEAD --abbrev=0) >> $GITHUB_OUTPUT

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
# Only worked for us with this option on
with:
install: true

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
# Key is named differently to avoid collision
key: ${{ runner.os }}-${{ env.ENV }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.ENV }}-buildx

- name: Log in to dockerhub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Extract metadata for docker
if: github.event_name == 'push'
id: meta
uses: docker/metadata-action@v3
with:
images: aeternity/smart-contract-verifier-worker
tags: |
type=raw,value=${{ steps.release_tag.outputs.TAG }}

- name: Build and push docker image
if: github.event_name == 'push'
uses: docker/build-push-action@v2
with:
context: .
file: ./apps/scv-worker/dev/Dockerfile
push: true
target: prod
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new

- name: Move cache
if: github.event_name == 'push'
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

- uses: actions/checkout@v2
with:
repository: aeternity/gitops-apps-aelabs.git
ref: prd
token: ${{ secrets.BOT_GITHUB_TOKEN }}
persist-credentials: false
fetch-depth: 0

- name: Production Deploy
uses: aeternity/ae-github-actions/argocd-deploy@v4
with:
git-sha: ${{ steps.git-sha.outputs.GIT_SHA }}
url-prefix: ${{ steps.release_tag.outputs.TAG }}
env: ${{ env.ENV }}
app: ${{ env.APP }}

- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: aeternity/gitops-apps-aelabs
github_token: ${{ secrets.BOT_GITHUB_TOKEN }}
branch: prd
Loading
Loading