Skip to content

Commit

Permalink
Merge pull request tinybirdco#9 from tinybirdco/feature/validate_admi…
Browse files Browse the repository at this point in the history
…n_token_is_present

Validate ADMIN_TOKEN input
  • Loading branch information
jlmadurga authored Aug 8, 2023
2 parents f29ea93 + 9e6b37d commit 151aba4
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ jobs:
with:
python-version: "3.8"
architecture: "x64"

- name: Validate input
run: |
[[ "${{ secrets.admin_token }}" ]] || { echo "Set ADMIN_TOKEN variable"; exit 1; }
- name: Set environment variables
run: |
_ENV_FLAGS="${ENV_FLAGS:=--last-partition --wait}"
Expand Down Expand Up @@ -115,6 +120,10 @@ jobs:
python-version: "3.8"
architecture: "x64"

- name: Validate input
run: |
[[ "${{ secrets.admin_token }}" ]] || { echo "Set ADMIN_TOKEN variable"; exit 1; }
- name: Install Tinybird CLI
run: pip install tinybird-cli

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
python-version: "3.8"
architecture: "x64"

- name: Validate input
run: |
[[ "${{ secrets.admin_token }}" ]] || { echo "Set ADMIN_TOKEN variable"; exit 1; }
- name: Set environment variables
run: |
_ENV_FLAGS="${ENV_FLAGS:=--last-partition --wait}"
Expand Down Expand Up @@ -114,6 +118,10 @@ jobs:
python-version: "3.8"
architecture: "x64"

- name: Validate input
run: |
[[ "${{ secrets.admin_token }}" ]] || { echo "Set ADMIN_TOKEN variable"; exit 1; }
- name: Install Tinybird CLI
run: pip install tinybird-cli

Expand Down
11 changes: 11 additions & 0 deletions .gitlab/ci_cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ variables:
PYTHON_VERSION: "3.11"
IMAGE_BASE: python:${PYTHON_VERSION}-slim-bullseye


.validate_input: &validate_input
- |
if [[ $ADMIN_TOKEN =~ .*ADMIN_TOKEN ]]; then
echo "Set ADMIN_TOKEN variable"; exit 1;
fi
.run_ci:
stage: ci
image: ${IMAGE_BASE}
interruptible: true
before_script:
- apt-get update && apt-get install -y --no-install-recommends git
script:
- *validate_input
- _ENV_FLAGS="${ENV_FLAGS:=--last-partition --wait}"
- cd $CI_PROJECT_DIR/$DATA_PROJECT_DIR
- _NORMALIZED_ENV_NAME=$(echo $DATA_PROJECT_DIR | rev | cut -d "/" -f 1 | rev | tr '.-' '_')
Expand Down Expand Up @@ -77,6 +85,7 @@ variables:
before_script:
- apt-get update && apt-get install -y --no-install-recommends git
script:
- *validate_input
- _ENV_FLAGS="${ENV_FLAGS:=--last-partition --wait}"
- cd $CI_PROJECT_DIR/$DATA_PROJECT_DIR
- _NORMALIZED_ENV_NAME=$(echo $DATA_PROJECT_DIR | rev | cut -d "/" -f 1 | rev | tr '.-' '_')
Expand Down Expand Up @@ -144,6 +153,7 @@ variables:
stage: cleanup
image: ${IMAGE_BASE}
script:
- *validate_input
- cd $CI_PROJECT_DIR/$DATA_PROJECT_DIR
- _NORMALIZED_ENV_NAME=$(echo $DATA_PROJECT_DIR | rev | cut -d "/" -f 1 | rev | tr '.-' '_')

Expand All @@ -169,6 +179,7 @@ variables:
stage: cleanup
image: ${IMAGE_BASE}
script:
- *validate_input
- cd $CI_PROJECT_DIR/$DATA_PROJECT_DIR
- _NORMALIZED_ENV_NAME=$(echo $DATA_PROJECT_DIR | rev | cut -d "/" -f 1 | rev | tr '.-' '_')

Expand Down

0 comments on commit 151aba4

Please sign in to comment.