-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging to release-5.3: [TT-13769] Extend plugin compiler test with a…
…rm64 cross build (#6813) [TT-13769] Extend plugin compiler test with arm64 cross build (#6813) ### **PR Type** tests ___ ### **Description** - Extended the plugin compiler test script to include a cross-compilation step for the `arm64` architecture. - Added a Docker command with the `GOARCH=arm64` environment variable to enable arm64 builds. - Ensures compatibility and testing for arm64 architecture in the plugin compiler. ___ ### **Changes walkthrough** 📝 <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Tests</strong></td><td><table> <tr> <td> <details> <summary><strong>test.sh</strong><dd><code>Add arm64 cross-compilation to plugin compiler test script</code></dd></summary> <hr> ci/tests/plugin-compiler/test.sh <li>Added a cross-compilation step for building the plugin for the <code>arm64</code> <br>architecture.<br> <li> Introduced the use of the <code>GOARCH=arm64</code> environment variable in the <br>Docker command.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6813/files#diff-2a616e71f9e61519f1e7fcd658f73d83a8ae561ef3108da000e7f5d77e38c244">+3/-0</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: Comment `/help "your question"` on any pull request to receive relevant information --------- Co-authored-by: Tit Petric <[email protected]>
- Loading branch information
Showing
5 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# QA Plugin | ||
|
||
The only difference between this and other plugins is that this one does | ||
not provide a go.mod. This means a slightly different build path is | ||
tested for the plugin compiler, ensuring coverage for when no go.mod is | ||
provided. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/TykTechnologies/tyk/ctx" | ||
"github.com/TykTechnologies/tyk/log" | ||
"github.com/TykTechnologies/tyk/user" | ||
) | ||
|
||
var logger = log.Get() | ||
|
||
// AddFooBarHeader adds custom "Foo: Bar" header to the request | ||
func AddFooBarHeader(rw http.ResponseWriter, r *http.Request) { | ||
r.Header.Add("Foo", "Bar") | ||
} | ||
|
||
// Custom Auth, applies a rate limit of | ||
// 2 per 10 given a token of "abc" | ||
func AuthCheck(rw http.ResponseWriter, r *http.Request) { | ||
token := r.Header.Get("Authorization") | ||
if token != "d3fd1a57-94ce-4a36-9dfe-679a8f493b49" && token != "3be61aa4-2490-4637-93b9-105001aa88a5" { | ||
rw.WriteHeader(http.StatusUnauthorized) | ||
return | ||
} | ||
session := &user.SessionState{ | ||
Alias: token, | ||
Rate: 2, | ||
Per: 10, | ||
MetaData: map[string]interface{}{ | ||
token: token, | ||
}, | ||
KeyID: token, | ||
} | ||
ctx.SetSession(r, session, true) | ||
} | ||
func main() {} | ||
func init() { | ||
logger.Info("--- Go custom plugin v4 init success! ---- ") | ||
} |