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

Merge branch 'shellcheck' into 'main'

Run shellcheck in Ci for gitlab-tofu

See merge request components/opentofu!32
parents a8d25619 b77f8f08
No related branches found
No related tags found
No related merge requests found
......@@ -111,6 +111,20 @@ check-backports:
- make backports
- 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:
extends: .opentofu-versions
rules:
......
......@@ -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" \
"$CI_API_GRAPHQL_URL" \
-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)"'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment