Skip to content

Commit

Permalink
test authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
nesmabadr committed Feb 20, 2024
1 parent 22f83b8 commit f5d06a6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
14 changes: 4 additions & 10 deletions .github/workflows/upload-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'v?[0-9]+.[0-9]+.[0-9]+(?:-.*)?'
permissions:
id-token: write
contents: read
contents: write

jobs:
upload-assets:
Expand All @@ -24,17 +24,11 @@ jobs:
name: Authenticate with GCP
uses: 'google-github-actions/auth@v2'
with:
token_format: 'access_token'
project_id: 'sap-kyma-jellyfish-dev'
workload_identity_provider: 'projects/718973091829/locations/global/workloadIdentityPools/github-action/providers/github-actions'
service_account: '[email protected]'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 363.0.0'
- name: Login to gcloud
run: |-
gcloud info
#- name: Run upload assets script
# run: bash ./scripts/release/upload_assets.sh
- name: Run upload assets script
run: bash ./scripts/release/upload_assets.sh


2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ endif

# This will change the flags of the `kyma alpha module create` command in case we spot credentials
# Otherwise we will assume http-based local registries without authentication (e.g. for k3d)
ifneq (,$(PROW_JOB_ID))
ifneq (,$(PULL_BASE_REF))
GCP_ACCESS_TOKEN=$(shell gcloud auth application-default print-access-token)
MODULE_CREATION_FLAGS=--registry $(MODULE_REGISTRY) --module-archive-version-overwrite -c oauth2accesstoken:$(GCP_ACCESS_TOKEN)
else ifeq (,$(MODULE_CREDENTIALS))
Expand Down
4 changes: 2 additions & 2 deletions scripts/release/upload_assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ echo "Fetching releases"
CURL_RESPONSE=$(curl -w "%{http_code}" -sL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN"\
https://api.github.com/repos/kyma-project/template-operator/releases)
https://api.github.com/repos/nesmabadr/template-operator/releases)
JSON_RESPONSE=$(sed '$ d' <<< "${CURL_RESPONSE}")
HTTP_CODE=$(tail -n1 <<< "${CURL_RESPONSE}")
if [[ "${HTTP_CODE}" != "200" ]]; then
Expand All @@ -58,7 +58,7 @@ then
fi

echo "Adding assets to Github release"
UPLOAD_URL="https://uploads.github.com/repos/kyma-project/template-operator/releases/${RELEASE_ID}/assets"
UPLOAD_URL="https://uploads.github.com/repos/nesmabadr/template-operator/releases/${RELEASE_ID}/assets"

echo "$UPLOAD_URL"
uploadFile "template-operator.yaml" "${UPLOAD_URL}?name=template-operator.yaml"
Expand Down

0 comments on commit f5d06a6

Please sign in to comment.