-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from stakater/init-commit
Init commit
- Loading branch information
Showing
61 changed files
with
9,363 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Pull Request | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths-ignore: | ||
- 'README.md' | ||
env: | ||
DOCKER_FILE_PATH: Dockerfile | ||
GOLANG_VERSION: 1.16 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Build | ||
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Configure git for private modules | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
run: | | ||
git config --global url."https://stakater-github-root:${GITHUB_TOKEN}@github.com/stakater-ab/oauth-proxy".insteadOf "https://github.com/stakater-ab/oauth-proxy" | ||
git config --global user.name stakater-github-root | ||
- name: Set up Go | ||
id: go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
|
||
- name: Lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.39.0 | ||
golangci-lint run --timeout=10m ./... | ||
# - name: Test | ||
# run: GOFLAGS="-count=1" go test -v ./... -coverprofile cover.out | ||
|
||
- name: Generate Tag | ||
id: generate_tag | ||
run: | | ||
sha=${{ github.event.pull_request.head.sha }} | ||
tag="SNAPSHOT-PR-${{ github.event.pull_request.number }}-${sha:0:8}" | ||
echo "##[set-output name=GIT_TAG;]$(echo ${tag})" | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.STAKATER_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }} | ||
|
||
- name: Generate image repository path | ||
run: | | ||
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ${{ env.DOCKER_FILE_PATH }} | ||
pull: true | ||
push: true | ||
build-args: GIT_ACCESS_TOKEN=${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
cache-to: type=inline | ||
tags: | | ||
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.GIT_TAG }} | ||
labels: | | ||
org.opencontainers.image.source=${{ github.event.repository.clone_url }} | ||
org.opencontainers.image.created=${{ steps.prep.outputs.created }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
- name: Comment on PR | ||
uses: mshick/add-pr-comment@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
with: | ||
message: '@${{ github.actor }} Image is available for testing. `docker pull ${{ github.repository }}:${{ steps.generate_tag.outputs.GIT_TAG }}`' | ||
allow-repeats: false | ||
|
||
- name: Notify Failure | ||
if: failure() | ||
uses: mshick/add-pr-comment@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
with: | ||
message: '@${{ github.actor }} Yikes! You better fix it before anyone else finds out! [Build](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}/checks) has Failed!' | ||
allow-repeats: false | ||
|
||
- name: Notify Slack | ||
uses: 8398a7/action-slack@v3 | ||
if: always() # Pick up events even if the job fails or is canceled. | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,author,action,eventName,ref,workflow | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }} |
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,95 @@ | ||
name: Push | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
DOCKER_FILE_PATH: Dockerfile | ||
GOLANG_VERSION: 1.16 | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | ||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo | ||
|
||
- name: Set up Go | ||
id: go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
|
||
- name: Lint | ||
run: | | ||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.39.0 | ||
golangci-lint run --timeout=10m ./... | ||
# - name: Test | ||
# run: GOFLAGS="-count=1" go test -v ./... -coverprofile cover.out | ||
|
||
- name: Generate Tag | ||
id: generate_tag | ||
uses: anothrNick/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
RELEASE_BRANCHES: main | ||
WITH_V: true | ||
DEFAULT_BUMP: patch | ||
DRY_RUN: true | ||
|
||
- name: Login to Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.STAKATER_DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.STAKATER_DOCKERHUB_PASSWORD }} | ||
|
||
- name: Generate image repository path | ||
run: | | ||
echo IMAGE_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | ||
- name: Build and push Docker images | ||
uses: docker/build-push-action@v1 | ||
with: | ||
context: . | ||
file: ${{ env.DOCKER_FILE_PATH }} | ||
pull: true | ||
push: true | ||
build-args: BUILD_PARAMETERS=${{ env.BUILD_PARAMETERS }} | ||
cache-to: type=inline | ||
tags: | | ||
${{ env.IMAGE_REPOSITORY }}:${{ steps.generate_tag.outputs.new_tag }} | ||
labels: | | ||
org.opencontainers.image.source=${{ github.event.repository.clone_url }} | ||
org.opencontainers.image.created=${{ steps.prep.outputs.created }} | ||
org.opencontainers.image.revision=${{ github.sha }} | ||
############################## | ||
## Add steps to generate required artifacts for a release here(helm chart, operator manifest etc.) | ||
############################## | ||
|
||
- name: Push Latest Tag | ||
uses: anothrNick/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
RELEASE_BRANCHES: main | ||
WITH_V: true | ||
DEFAULT_BUMP: patch | ||
|
||
- name: Notify Slack | ||
uses: 8398a7/action-slack@v3 | ||
if: always() # Pick up events even if the job fails or is canceled. | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,author,action,eventName,ref,workflow | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }} |
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,44 @@ | ||
name: Release Go project | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
env: | ||
GOLANG_VERSION: 1.16 | ||
|
||
jobs: | ||
build: | ||
name: GoReleaser build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # See: https://goreleaser.com/ci/actions/ | ||
|
||
- name: Set up Go 1.x | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GOLANG_VERSION }} | ||
id: go | ||
|
||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@master | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
|
||
- name: Notify Slack | ||
uses: 8398a7/action-slack@v3 | ||
if: always() | ||
with: | ||
status: ${{ job.status }} | ||
fields: repo,author,action,eventName,ref,workflow | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STAKATER_GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.STAKATER_DELIVERY_SLACK_WEBHOOK }} |
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,10 @@ | ||
FROM golang:alpine3.13 AS builder | ||
WORKDIR /opt/oauth-proxy | ||
COPY . . | ||
RUN go build . | ||
|
||
FROM alpine:3.13 | ||
COPY --from=builder /opt/oauth-proxy/oauth-proxy /usr/bin/oauth-proxy | ||
RUN chmod +x /usr/bin/oauth-proxy | ||
USER 1001 | ||
ENTRYPOINT ["/usr/bin/oauth-proxy"] |
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,17 @@ | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,35 @@ | ||
.PHONY: all | ||
|
||
# Include the library makefile | ||
include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \ | ||
golang.mk \ | ||
targets/openshift/deps-gomod.mk \ | ||
targets/openshift/images.mk \ | ||
) | ||
|
||
IMAGE_REGISTRY?=registry.svc.ci.openshift.org | ||
|
||
# This will call a macro called "build-image" which will generate image specific targets based on the parameters: | ||
# $0 - macro name | ||
# $1 - target name | ||
# $2 - image ref | ||
# $3 - Dockerfile path | ||
# $4 - context directory for image build | ||
# It will generate target "image-$(1)" for building the image and binding it as a prerequisite to target "images". | ||
$(call build-image,ocp-oauth-proxy,$(IMAGE_REGISTRY)/ocp/4.6:oauth-proxy,./Dockerfile,.) | ||
|
||
clean: | ||
$(RM) ./oauth-proxy | ||
.PHONY: clean | ||
|
||
GO_BUILD_PACKAGES := . | ||
# avoid the test/ directory only containing the e2e tests | ||
GO_TEST_PACKAGES :=./ ./api/... ./cookie/... ./providers/... ./util/... | ||
|
||
test-e2e: GO_TEST_PACKAGES :=./test/e2e/... | ||
test-e2e: GO_TEST_FLAGS += -v | ||
test-e2e: GO_TEST_FLAGS += -timeout 3h | ||
test-e2e: GO_TEST_FLAGS += -count 1 | ||
test-e2e: GO_TEST_FLAGS += -p 1 | ||
test-e2e: test-unit | ||
.PHONY: test-e2e |
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,7 @@ | ||
reviewers: | ||
- usamaahmadkhan | ||
- talha0324 | ||
|
||
approvers: | ||
- usamaahmadkhan | ||
- talha0324 |
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 |
---|---|---|
@@ -1,2 +1,15 @@ | ||
# oauth-proxy | ||
Stakater's OpenShift oauth-proxy | ||
===================== | ||
|
||
This is a fork of the https://github.com/openshift/oauth-proxy project with change in the sign_in and error | ||
page customized for the use of Stakater App Agility Platform. | ||
|
||
## Stakater's Customizations | ||
|
||
- Sign in page | ||
- Errors page | ||
- alpine:3.13 as base image image | ||
|
||
The changed templates can be found under stakater/templates dir. These templates have been hardcoded into `templates.go` file | ||
|
||
Plz find detailed README here: https://github.com/openshift/oauth-proxy |
Oops, something went wrong.