Skip to content
Snippets Groups Projects
Unverified Commit b77f8f08 authored by Timo Furrer's avatar Timo Furrer
Browse files

Run shellcheck in Ci for gitlab-tofu

parent a8d25619
No related branches found
No related tags found
No related merge requests found
...@@ -111,6 +111,20 @@ check-backports: ...@@ -111,6 +111,20 @@ check-backports:
- make backports - make backports
- git diff --exit-code - git diff --exit-code
shellcheck:
stage: test
needs: []
image: koalaman/shellcheck-alpine:v0.9.0
script:
- shellcheck ./src/gitlab-tofu.sh
- shellcheck ./.gitlab/scripts/*.sh
rules:
- changes:
- src/gitlab-tofu.sh
- .gitlab/scripts/*.sh
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
container_scanning: container_scanning:
extends: .opentofu-versions extends: .opentofu-versions
rules: rules:
......
...@@ -34,7 +34,7 @@ while $has_next_page; do ...@@ -34,7 +34,7 @@ while $has_next_page; do
data=$(curl --silent --show-error --fail -H "Authorization: Bearer $GITLAB_TOKEN" -H "Content-Type: application/json" \ data=$(curl --silent --show-error --fail -H "Authorization: Bearer $GITLAB_TOKEN" -H "Content-Type: application/json" \
"$CI_API_GRAPHQL_URL" \ "$CI_API_GRAPHQL_URL" \
-X POST \ -X POST \
--data '[{ "operationName": "getStates", "variables": { "projectPath": "'$CI_PROJECT_PATH'", "first": 100, "after":'"$after"', "last": null, "before": null }, "query": "query getStates($projectPath: ID!, $first: Int, $last: Int, $before: String, $after: String) { project(fullPath: $projectPath) { id terraformStates(first: $first, last: $last, before: $before, after: $after) { count nodes { name updatedAt } pageInfo { hasNextPage endCursor } } } } " } ] ' --data '[{ "operationName": "getStates", "variables": { "projectPath": "'"$CI_PROJECT_PATH"'", "first": 100, "after":'"$after"', "last": null, "before": null }, "query": "query getStates($projectPath: ID!, $first: Int, $last: Int, $before: String, $after: String) { project(fullPath: $projectPath) { id terraformStates(first: $first, last: $last, before: $before, after: $after) { count nodes { name updatedAt } pageInfo { hasNextPage endCursor } } } } " } ] '
) )
echo "$data" | jq --arg date "$FETCH_OLDER_THAN" -r '.[0]["data"]["project"]["terraformStates"]["nodes"][] | select(.updatedAt < $date) | "\(.name),\(.updatedAt)"' echo "$data" | jq --arg date "$FETCH_OLDER_THAN" -r '.[0]["data"]["project"]["terraformStates"]["nodes"][] | select(.updatedAt < $date) | "\(.name),\(.updatedAt)"'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment