-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Starting to play with URLs in e2e tests. (#75)
* Starting to play with URLs in e2e tests. Signed-off-by: Ville Aikas <[email protected]> * bump hoping to kick the actions into gear. Signed-off-by: Ville Aikas <[email protected]> * moar Signed-off-by: Ville Aikas <[email protected]> * Retrying push due to git outage. Signed-off-by: Ville Aikas <[email protected]> * Add a simple knative service for fetch oidc tokens off the cluster for testing external access with fulcio as well. Signed-off-by: Ville Aikas <[email protected]> * Test with k8s version: 1.21, 1.22, and 1.23 Signed-off-by: Ville Aikas <[email protected]> * install cosign by checking out the main for it and go install. Signed-off-by: Ville Aikas <[email protected]> * Bump job retry count to 12. Signed-off-by: Ville Aikas <[email protected]> * Put it in the wrong place :) Signed-off-by: Ville Aikas <[email protected]> * Comment out 1.23 for now due to wierd job backoff behaviour. Signed-off-by: Ville Aikas <[email protected]>
- Loading branch information
Showing
14 changed files
with
212 additions
and
153 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2022 The Sigstore Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"log" | ||
"net/http" | ||
|
||
"github.com/kelseyhightower/envconfig" | ||
) | ||
|
||
type envConfig struct { | ||
FileName string `envconfig:"OIDC_FILE" default:"/var/run/sigstore/cosign/oidc-token" required:"true"` | ||
} | ||
|
||
// tokenFile is where we mount the oidc token from k8s. | ||
//const tokenFile = "/var/run/sigstore/cosign/oidc-token" | ||
const tokenFile = "/Users/vaikas/projects/go/src/github.com/sigstore/scaffolding/ctlog-public.pem" | ||
|
||
func tokenWriter(filename string) func(http.ResponseWriter, *http.Request) { | ||
return func(w http.ResponseWriter, req *http.Request) { | ||
getToken(filename, w, req) | ||
} | ||
} | ||
func getToken(tokenFile string, w http.ResponseWriter, req *http.Request) { | ||
content, err := ioutil.ReadFile(tokenFile) | ||
if err != nil { | ||
log.Print("failed to read token file", err) | ||
http.Error(w, err.Error(), http.StatusInternalServerError) | ||
return | ||
} | ||
_, err = fmt.Fprint(w, string(content)) | ||
if err != nil { | ||
log.Print("failed to write token file to response", err) | ||
http.Error(w, err.Error(), http.StatusInternalServerError) | ||
} | ||
} | ||
|
||
func main() { | ||
var env envConfig | ||
if err := envconfig.Process("", &env); err != nil { | ||
log.Fatalf("failed to process env var: %s", err) | ||
} | ||
http.HandleFunc("/", tokenWriter(env.FileName)) | ||
if err := http.ListenAndServe(":8080", nil); err != nil { | ||
panic(err) | ||
} | ||
} |
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
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,24 @@ | ||
apiVersion: serving.knative.dev/v1 | ||
kind: Service | ||
metadata: | ||
name: gettoken | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: gettoken | ||
image: ko://github.com/sigstore/scaffolding/cmd/getoidctoken | ||
env: | ||
- name: OIDC_FILE | ||
value: "/var/run/sigstore/cosign/oidc-token" | ||
volumeMounts: | ||
- name: oidc-info | ||
mountPath: /var/run/sigstore/cosign | ||
volumes: | ||
- name: oidc-info | ||
projected: | ||
sources: | ||
- serviceAccountToken: | ||
path: oidc-token | ||
expirationSeconds: 600 | ||
audience: sigstore |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.