Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

feat(relative): implement relative actions #116

Merged
merged 3 commits into from
Feb 7, 2022
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
17 changes: 11 additions & 6 deletions autodevops-create-db/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ runs:

- name: Checkout repository
uses: actions/checkout@v2

- name: Enable Relative Github Actions
uses: socialgouv/actions/util-enable-relative-gh-actions@v1
with:
actionPath: ${{ github.action_path }}

- name: Setup global env vars
uses: socialgouv/actions/util-env@v1
uses: ./.socialgouv/actions/util-env
with:
rancherId: ${{ inputs.rancherId }}

Expand All @@ -42,12 +47,12 @@ runs:
echo "ADMIN_PG_SECRET=$ADMIN_PG_SECRET" >> $GITHUB_ENV

- name: Write kubeconfig
uses: socialgouv/actions/util-write-kubeconfig@v1
uses: ./.socialgouv/actions/util-write-kubeconfig
with:
kubeconfig: ${{ inputs.kubeconfig }}

- name: Setup node
uses: socialgouv/actions/util-setup-node@v1
uses: ./.socialgouv/actions/util-setup-node
with:
actionPath: ${{ github.action_path }}

Expand All @@ -62,7 +67,7 @@ runs:
path: values.json

- name: Ensure namespace exists
uses: socialgouv/actions/util-ensure-namespace@v1
uses: ./.socialgouv/actions/util-ensure-namespace
with:
namespace: ${{ env.NAMESPACE }}
rancherId: ${{ env.RANCHER_PROJECT_ID }}
Expand All @@ -77,7 +82,7 @@ runs:
copy-secret $DB_SECRET_NAME $NAMESPACE $JOB_NAMESPACE

- name: Run create-db job
uses: socialgouv/actions/util-run-job@v1
uses: ./.socialgouv/actions/util-run-job
with:
jobNamespace: ${{ env.JOB_NAMESPACE }}
jobName: create-db-user-${{ env.BRANCH_SLUG }}
Expand All @@ -86,7 +91,7 @@ runs:
actionPath: ${{ github.action_path }}

- name: Wait for create-db job completion
uses: socialgouv/actions/util-wait-job@v1
uses: ./.socialgouv/actions/util-wait-job
with:
jobNamespace: ${{ env.JOB_NAMESPACE }}
jobName: create-db-user-${{ env.BRANCH_SLUG }}
Expand Down
9 changes: 7 additions & 2 deletions autodevops-deactivate/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ runs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Enable Relative Github Actions
uses: socialgouv/actions/util-enable-relative-gh-actions@v1
with:
actionPath: ${{ github.action_path }}

# could be extracted in some external action
- name: Get k8s infos
id: k8s
Expand All @@ -28,7 +33,7 @@ runs:
echo "::set-output name=branch::$(echo ${BRANCH})"

- name: Write kubeconfig
uses: socialgouv/actions/util-write-kubeconfig@v1
uses: ./.socialgouv/actions/util-write-kubeconfig
with:
kubeconfig: ${{ inputs.kube-config }}

Expand All @@ -49,7 +54,7 @@ runs:

# new version
# - name: Drop database
# uses: SocialGouv/actions/autodevops-drop-db@v1
# uses: ./.socialgouv/actions/autodevops-drop-db
# with:
# kubeconfig: ${{ inputs.kube-config }}
# rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
Expand Down
7 changes: 6 additions & 1 deletion autodevops-deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ runs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Enable Relative Github Actions
uses: socialgouv/actions/util-enable-relative-gh-actions@v1
with:
actionPath: ${{ github.action_path }}

- name: Download k8s namespace
uses: actions/download-artifact@v2
with:
Expand Down Expand Up @@ -104,7 +109,7 @@ runs:
env_url: ${{ steps.environment-url.outputs.url }}

- name: Debug manifests
uses: socialgouv/actions/k8s-manifests-debug@v1
uses: ./.socialgouv/actions/k8s-manifests-debug
with:
token: ${{ inputs.token }}
path: manifests-${{ inputs.environment }}.yml
Expand Down
15 changes: 10 additions & 5 deletions autodevops-drop-db/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ runs:

- name: Checkout repository
uses: actions/checkout@v2

- name: Enable Relative Github Actions
uses: socialgouv/actions/util-enable-relative-gh-actions@v1
with:
actionPath: ${{ github.action_path }}

- name: Setup global env vars
uses: socialgouv/actions/util-env@v1
uses: ./.socialgouv/actions/util-env
with:
rancherId: ${{ inputs.rancherId }}

Expand Down Expand Up @@ -56,25 +61,25 @@ runs:
echo "DB_USER=$DB_USER" >> $GITHUB_ENV

- name: Write kubeconfig
uses: socialgouv/actions/util-write-kubeconfig@v1
uses: ./.socialgouv/actions/util-write-kubeconfig
with:
kubeconfig: ${{ inputs.kubeconfig }}

- name: Setup node
uses: socialgouv/actions/util-setup-node@v1
uses: ./.socialgouv/actions/util-setup-node
with:
actionPath: ${{ github.action_path }}

- name: Run drop-db job
uses: socialgouv/actions/util-run-job@v1
uses: ./.socialgouv/actions/util-run-job
with:
jobNamespace: ${{ env.JOB_NAMESPACE }}
jobName: drop-db-${{ env.BRANCH_SLUG }}
jobTemplatePath: ${{ github.action_path }}/templates/job.drop-db.gtpl
actionPath: ${{ github.action_path }}

- name: Wait for drop-db job completion
uses: socialgouv/actions/util-wait-job@v1
uses: ./.socialgouv/actions/util-wait-job
with:
jobNamespace: ${{ env.JOB_NAMESPACE }}
jobName: drop-db-${{ env.BRANCH_SLUG }}
Expand Down
10 changes: 9 additions & 1 deletion autodevops-job/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,16 @@ runs:
using: "composite"
steps:

- name: Checkout repository
uses: actions/checkout@v2

- name: Enable Relative Github Actions
uses: socialgouv/actions/util-enable-relative-gh-actions@v1
with:
actionPath: ${{ github.action_path }}

- name: Generate manifests
uses: socialgouv/actions/autodevops-manifests@v1
uses: ./.socialgouv/actions/autodevops-manifests
with:
environment: ${{ inputs.environment }}
kosko-args: ${{ inputs.kosko-args }}
Expand Down
5 changes: 5 additions & 0 deletions autodevops-restore-db/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ runs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Enable Relative Github Actions
uses: socialgouv/actions/util-enable-relative-gh-actions@v1
with:
actionPath: ${{ github.action_path }}

- name: Get project and namespace names
shell: bash
run: |
Expand Down
14 changes: 11 additions & 3 deletions autodevops/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ runs:
using: "composite"
steps:

- name: Checkout repository
uses: actions/checkout@v2

- name: Enable Relative Github Actions
uses: socialgouv/actions/util-enable-relative-gh-actions@v1
with:
actionPath: ${{ github.action_path }}

- name: Use autodevops build and register
uses: SocialGouv/actions/autodevops-build-register@master
uses: ./.socialgouv/actions/autodevops-build-register
with:
token: ${{ inputs.token }}
project: ${{ inputs.project }}
Expand All @@ -41,7 +49,7 @@ runs:
dockerbuildargs: ${{ inputs.dockerbuildargs }}

- name: Use autodevops manifests generation
uses: SocialGouv/actions/autodevops-manifests@master
uses: ./.socialgouv/actions/autodevops-manifests
with:
rancherId: ${{ inputs.rancherId }}
environment: ${{ inputs.environment }}
Expand All @@ -50,7 +58,7 @@ runs:

- name: Use autodevops deployment
id: deploy
uses: SocialGouv/actions/autodevops-deploy@master
uses: ./.socialgouv/actions/autodevops-deploy
with:
token: ${{ inputs.token }}
rancherId: ${{ inputs.rancherId }}
Expand Down
8 changes: 4 additions & 4 deletions util-ensure-namespace/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
using: "composite"
steps:
- name: Setup node
uses: socialgouv/actions/util-setup-node@v1
uses: ./.socialgouv/actions/util-setup-node
with:
actionPath: ${{ github.action_path }}

Expand All @@ -25,13 +25,13 @@ runs:
export RANCHER_PROJECT_ID=${{ inputs.rancherId || env.RANCHER_PROJECT_ID }}
cd ${{ github.action_path }}
cat templates/namespace.gtpl | \
gomplate -d values.json > namespace.yml
gomplate -d values.json > ${GITHUB_WORKSPACE}/namespace.${{ inputs.namespace || env.NAMESPACE }}.yml

- name: Archive namespace manifests
uses: actions/upload-artifact@v2
with:
name: namespace.${{ inputs.namespace }}.yml
path: ${{ github.action_path }}/namespace.yml
name: namespace.${{ inputs.namespace || env.NAMESPACE }}.yml
path: namespace.${{ inputs.namespace || env.NAMESPACE }}.yml

- name: Ensure namespace exists
shell: bash
Expand Down