Skip to content

Commit 0bd9439

Browse files
committed
INST-12724 - Added azure support to the plugin and changed binary names
1 parent fd549ab commit 0bd9439

5 files changed

Lines changed: 15 additions & 19 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ jobs:
5555
draft: false
5656
prerelease: true
5757
files: |
58-
build/bin/jfrog-credential-provider-aws-linux-amd64
59-
build/bin/jfrog-credential-provider-aws-linux-arm64
58+
build/bin/jfrog-credential-provider-linux-amd64
59+
build/bin/jfrog-credential-provider-linux-arm64
6060
fail_on_unmatched_files: true

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,17 @@ jobs:
4141
- name: Sign Binaries
4242
run: |
4343
cd build/bin/
44-
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --detach-sign --armor jfrog-credential-provider-aws-linux-amd64
45-
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --detach-sign --armor jfrog-credential-provider-aws-linux-arm64
44+
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --detach-sign --armor jfrog-credential-provider-linux-amd64
45+
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --pinentry-mode loopback --passphrase-fd 0 --detach-sign --armor jfrog-credential-provider-linux-arm64
4646
4747
- name: Upload release artifacts
4848
uses: softprops/action-gh-release@v2
4949
with:
5050
tag_name: ${{ github.event.inputs.tag }}
5151
generate_release_notes: true
5252
files: |
53-
build/bin/jfrog-credential-provider-aws-linux-amd64
54-
build/bin/jfrog-credential-provider-aws-linux-arm64
55-
build/bin/jfrog-credential-provider-aws-linux-amd64.asc
56-
build/bin/jfrog-credential-provider-aws-linux-arm64.asc
53+
build/bin/jfrog-credential-provider-linux-amd64
54+
build/bin/jfrog-credential-provider-linux-arm64
55+
build/bin/jfrog-credential-provider-linux-amd64.asc
56+
build/bin/jfrog-credential-provider-linux-arm64.asc
5757

internal/autoupdate/fetch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ func downloadLatestBinary(ctx context.Context, logs *logger.Logger, client *http
184184
logs.Info("Release tag '%s' is missing 'v' prefix. Prepending 'v'." + newVersion)
185185
newVersion = strings.TrimPrefix(newVersion, "v")
186186
}
187-
downloadUrl := jfrogPluginDownloadUrl + downloadSuffix + newVersion + "/jfrog-credential-provider-aws-linux-" + getArchSuffix(logs)
187+
downloadUrl := jfrogPluginDownloadUrl + downloadSuffix + newVersion + "/jfrog-credential-provider-linux-" + getArchSuffix(logs)
188188
logs.Info("Downloading new binary from: " + downloadUrl)
189189
downloadSignUrl := downloadUrl + ".asc"
190190
err := downloadReleaseArtifacts(ctx, logs, client, newBinaryPath, downloadUrl)

internal/handlers/aws.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ func getResourceServerId(s *service.Service, cfg aws.Config, userPoolName string
399399
}
400400

401401
func CheckIfAWS(s *service.Service, ctx context.Context) (bool, error) {
402+
s.Logger.Info("Checking if cloud provider is AWS")
402403
req, err := http.NewRequestWithContext(ctx, "GET", METADATA_URL, nil)
403404
if err != nil {
404405
return false, fmt.Errorf("Error creating request to check if cloud provider is AWS: %v", err)
@@ -408,5 +409,6 @@ func CheckIfAWS(s *service.Service, ctx context.Context) (bool, error) {
408409
return false, fmt.Errorf("Error checking if cloud provider is AWS: %v", err)
409410
}
410411
defer resp.Body.Close()
412+
s.Logger.Info(fmt.Sprintf("AWS metadata server response status code: %d", resp.StatusCode))
411413
return (resp.StatusCode == http.StatusOK), nil
412414
}

internal/handlers/azure.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package handlers
1616

1717
import (
18-
"bytes"
1918
"context"
2019
"encoding/json"
2120
"fmt"
@@ -153,22 +152,17 @@ func GetAzureOIDCToken(s *service.Service, ctx context.Context,
153152
}
154153

155154
func CheckIfAzure(s *service.Service, ctx context.Context) (bool, error) {
156-
body, err := json.Marshal(map[string]string{
157-
"Metadata": "true",
158-
})
159-
if err != nil {
160-
return false, fmt.Errorf("Error marshaling request body: %v", err)
161-
}
162-
163-
req, err := http.NewRequestWithContext(ctx, "GET", AZURE_METADATA_URL, bytes.NewBuffer(body))
155+
s.Logger.Info("Checking if cloud provider is Azure")
156+
req, err := http.NewRequestWithContext(ctx, "GET", AZURE_METADATA_URL, nil)
164157
if err != nil {
165158
return false, fmt.Errorf("Error creating request to check if cloud provider is Azure: %v", err)
166159
}
160+
req.Header.Add("Metadata", "true")
167161
resp, err := s.Client.Do(req)
168162
if err != nil {
169163
return false, fmt.Errorf("Error checking if cloud provider is Azure: %v", err)
170164
}
171165
defer resp.Body.Close()
172-
166+
s.Logger.Info(fmt.Sprintf("Azure metadata server response status code: %d", resp.StatusCode))
173167
return (resp.StatusCode == http.StatusOK), nil
174168
}

0 commit comments

Comments
 (0)