Skip to content

Commit

Permalink
chore: apply linter
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed Feb 10, 2024
1 parent 1c634e1 commit 5664baf
Show file tree
Hide file tree
Showing 60 changed files with 97 additions and 265 deletions.
19 changes: 4 additions & 15 deletions .github/workflows/cd-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---
name: Deployment (Development)

on:
workflow_run:
workflows: ["Release Image (Development)"]
types:
- completed
workflows: [Release Image (Development)]
types: [completed]
workflow_dispatch:

jobs:
deploy-dev:
runs-on: ubuntu-latest
Expand All @@ -16,7 +14,6 @@ jobs:
environment:
name: development
url: https://api.development.basedosdados.org

steps:
- name: Download branch name
uses: actions/github-script@v6
Expand All @@ -38,19 +35,15 @@ jobs:
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/artifact.zip`, Buffer.from(download.data));
- name: Extract branch name
run: unzip artifact.zip

- name: Read branch name
id: extract_branch
run: echo "branch=$(cat branch)" >> "$GITHUB_OUTPUT"

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.extract_branch.outputs.branch }}

- name: Import secrets from Vault
id: import_secrets
uses: hashicorp/[email protected]
Expand All @@ -62,21 +55,18 @@ jobs:
secret/data/gcp_credentials/basedosdados-dev GH_ACTIONS_SA | GCP_SA ;
secret/data/gcp_credentials/basedosdados-dev GKE_CLUSTER_NAME | GKE_CLUSTER_NAME ;
secret/data/gcp_credentials/basedosdados-dev GKE_CLUSTER_ZONE | GKE_CLUSTER_ZONE ;
- name: Setup Google Cloud CLI
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ steps.import_secrets.outputs.GCP_SA }}
project_id: ${{ steps.import_secrets.outputs.GCP_PROJECT_ID }}
export_default_credentials: true

- name: Get GKE credentials
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ steps.import_secrets.outputs.GKE_CLUSTER_NAME }}
location: ${{ steps.import_secrets.outputs.GKE_CLUSTER_ZONE }}
credentials: ${{ steps.import_secrets.outputs.GCP_SA }}

- name: Write values.yaml file
run: |
cat << EOF > values.yaml
Expand Down Expand Up @@ -147,9 +137,8 @@ jobs:
- development.api.basedosdados.org
secretName: api-development-basedosdados-org-tls
EOF
- name: Deploy using Helm
run: |
run: |-
helm upgrade \
--wait \
--install \
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/cd-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
---
name: Deployment (Production)

on:
workflow_run:
workflows: ["Release Image (Production)"]
branches:
- main
types:
- completed
workflows: [Release Image (Production)]
branches: [main]
types: [completed]
workflow_dispatch:

jobs:
deploy-prod:
runs-on: ubuntu-latest
Expand All @@ -18,13 +15,11 @@ jobs:
environment:
name: production
url: https://api.basedosdados.org

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main

- name: Import secrets from Vault
id: import_secrets
uses: hashicorp/[email protected]
Expand All @@ -36,21 +31,18 @@ jobs:
secret/data/gcp_credentials/basedosdados-dev GH_ACTIONS_SA | GCP_SA ;
secret/data/gcp_credentials/basedosdados-dev GKE_CLUSTER_NAME | GKE_CLUSTER_NAME ;
secret/data/gcp_credentials/basedosdados-dev GKE_CLUSTER_ZONE | GKE_CLUSTER_ZONE ;
- name: Setup Google Cloud CLI
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ steps.import_secrets.outputs.GCP_SA }}
project_id: ${{ steps.import_secrets.outputs.GCP_PROJECT_ID }}
export_default_credentials: true

- name: Get GKE credentials
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ steps.import_secrets.outputs.GKE_CLUSTER_NAME }}
location: ${{ steps.import_secrets.outputs.GKE_CLUSTER_ZONE }}
credentials: ${{ steps.import_secrets.outputs.GCP_SA }}

- name: Write values.yaml file
run: |
cat << EOF > values.yaml
Expand Down Expand Up @@ -121,9 +113,8 @@ jobs:
- api.basedosdados.org
secretName: api-basedosdados-org-tls
EOF
- name: Deploy using Helm
run: |
run: |-
helm upgrade \
--wait \
--install \
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/cd-staging.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
---
name: Deployment (Staging)

on:
workflow_run:
workflows: ["Release Image (Staging)"]
branches:
- main
types:
- completed
workflows: [Release Image (Staging)]
branches: [main]
types: [completed]
workflow_dispatch:

jobs:
deploy-staging:
runs-on: ubuntu-latest
Expand All @@ -18,13 +15,11 @@ jobs:
environment:
name: staging
url: https://staging.api.basedosdados.org

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main

- name: Import secrets from Vault
id: import_secrets
uses: hashicorp/[email protected]
Expand All @@ -36,21 +31,18 @@ jobs:
secret/data/gcp_credentials/basedosdados-dev GH_ACTIONS_SA | GCP_SA ;
secret/data/gcp_credentials/basedosdados-dev GKE_CLUSTER_NAME | GKE_CLUSTER_NAME ;
secret/data/gcp_credentials/basedosdados-dev GKE_CLUSTER_ZONE | GKE_CLUSTER_ZONE ;
- name: Setup Google Cloud CLI
uses: google-github-actions/[email protected]
with:
service_account_key: ${{ steps.import_secrets.outputs.GCP_SA }}
project_id: ${{ steps.import_secrets.outputs.GCP_PROJECT_ID }}
export_default_credentials: true

- name: Get GKE credentials
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ steps.import_secrets.outputs.GKE_CLUSTER_NAME }}
location: ${{ steps.import_secrets.outputs.GKE_CLUSTER_ZONE }}
credentials: ${{ steps.import_secrets.outputs.GCP_SA }}

- name: Write values.yaml file
run: |
cat << EOF > values.yaml
Expand Down Expand Up @@ -121,9 +113,8 @@ jobs:
- staging.api.basedosdados.org
secretName: staging-api-basedosdados-org-tls
EOF
- name: Deploy using Helm
run: |
run: |-
helm upgrade \
--wait \
--install \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
subjectPatternError: |-
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
14 changes: 4 additions & 10 deletions .github/workflows/release-chart.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
---
name: Helm - Release chart

on:
push:
branches:
- main
paths:
- ".github/workflows/release-chart.yaml"
- "charts/**/*"

branches: [main]
paths: [.github/workflows/release-chart.yaml, charts/**/*]
jobs:
release-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 2 additions & 9 deletions .github/workflows/release-dev.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
---
name: Release Image (Development)

on:
pull_request:
types:
- labeled
types: [labeled]
workflow_dispatch:

jobs:
release-docker:
name: Release Image
Expand All @@ -22,19 +20,16 @@ jobs:
else
echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
fi
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.select_branch.outputs.branch }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push PR image
uses: docker/build-push-action@v2
with:
Expand All @@ -48,12 +43,10 @@ jobs:
org.opencontainers.image.revision=${{ github.sha }}
build-args: |
BUILDKIT_INLINE_CACHE=1
- name: Save branch name artifact
run: |
mkdir -p ./branch
echo -n ${{ steps.select_branch.outputs.branch }} > ./branch/branch
- name: Upload branch name artifact
uses: actions/upload-artifact@v3
with:
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/release-prod.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
name: Release Image (Production)

on: workflow_dispatch

jobs:
release-docker:
name: Release Image
Expand All @@ -11,14 +10,12 @@ jobs:
uses: actions/checkout@v4
with:
ref: main

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push stable tagged image
uses: docker/build-push-action@v2
with:
Expand All @@ -30,5 +27,5 @@ jobs:
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
build-args: |
build-args: |-
BUILDKIT_INLINE_CACHE=1
7 changes: 2 additions & 5 deletions .github/workflows/release-staging.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
name: Release Image (Staging)

on:
workflow_dispatch:

jobs:
release-docker:
name: Release Image
Expand All @@ -12,14 +11,12 @@ jobs:
uses: actions/checkout@v4
with:
ref: main

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push staging tagged image
uses: docker/build-push-action@v2
with:
Expand All @@ -31,5 +28,5 @@ jobs:
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.revision=${{ github.sha }}
build-args: |
build-args: |-
BUILDKIT_INLINE_CACHE=1
Loading

0 comments on commit 5664baf

Please sign in to comment.