Skip to content

Commit

Permalink
Merge pull request #1 from DataHow/fix/revert-4b5f1d52-2-35-x
Browse files Browse the repository at this point in the history
chore: revert "fix: refresh token only once for all concurrent requests"
  • Loading branch information
cippaciong authored Jul 24, 2023
2 parents 54c9e82 + 3dd4d2e commit a9b2085
Show file tree
Hide file tree
Showing 7 changed files with 237 additions and 510 deletions.
171 changes: 85 additions & 86 deletions .github/workflows/artifacts.yaml
Original file line number Diff line number Diff line change
@@ -1,97 +1,96 @@
name: Artifacts
# name: Artifacts

on:
push:
branches:
- master
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:
# on:
# push:
# branches:
# - master
# tags:
# - v[0-9]+.[0-9]+.[0-9]+
# pull_request:

jobs:
container-images:
name: Container images
runs-on: ubuntu-latest
strategy:
matrix:
variant:
- alpine
- distroless
# jobs:
# container-images:
# name: Container images
# runs-on: ubuntu-latest
# strategy:
# matrix:
# variant:
# - alpine
# - distroless

steps:
- name: Checkout
uses: actions/checkout@v3
# steps:
# - name: Checkout
# uses: actions/checkout@v3

- name: Gather metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/dexidp/dex
dexidp/dex
flavor: |
latest = false
tags: |
type=ref,event=branch,enable=${{ matrix.variant == 'alpine' }}
type=ref,event=pr,enable=${{ matrix.variant == 'alpine' }}
type=semver,pattern={{raw}},enable=${{ matrix.variant == 'alpine' }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && matrix.variant == 'alpine' }}
type=ref,event=branch,suffix=-${{ matrix.variant }}
type=ref,event=pr,suffix=-${{ matrix.variant }}
type=semver,pattern={{raw}},suffix=-${{ matrix.variant }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }},suffix=-${{ matrix.variant }}
labels: |
org.opencontainers.image.documentation=https://dexidp.io/docs/
# - name: Gather metadata
# id: meta
# uses: docker/metadata-action@v4
# with:
# images: |
# ghcr.io/datahow/dex
# flavor: |
# latest = false
# tags: |
# type=ref,event=branch,enable=${{ matrix.variant == 'alpine' }}
# type=ref,event=pr,enable=${{ matrix.variant == 'alpine' }}
# type=semver,pattern={{raw}},enable=${{ matrix.variant == 'alpine' }}
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && matrix.variant == 'alpine' }}
# type=ref,event=branch,suffix=-${{ matrix.variant }}
# type=ref,event=pr,suffix=-${{ matrix.variant }}
# type=semver,pattern={{raw}},suffix=-${{ matrix.variant }}
# type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }},suffix=-${{ matrix.variant }}
# labels: |
# org.opencontainers.image.documentation=https://dexidp.io/docs/

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
# with:
# platforms: all

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
if: github.event_name == 'push'
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ github.token }}
# if: github.event_name == 'push'

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: github.event_name == 'push'
# # - name: Login to Docker Hub
# # uses: docker/login-action@v2
# # with:
# # username: ${{ secrets.DOCKER_USERNAME }}
# # password: ${{ secrets.DOCKER_PASSWORD }}
# # if: github.event_name == 'push'

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le
# cache-from: type=gha
# cache-to: type=gha,mode=max
push: ${{ github.event_name == 'push' }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
BASE_IMAGE=${{ matrix.variant }}
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
COMMIT_HASH=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
labels: ${{ steps.meta.outputs.labels }}
# - name: Build and push
# uses: docker/build-push-action@v3
# with:
# context: .
# platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le
# # cache-from: type=gha
# # cache-to: type=gha,mode=max
# push: ${{ github.event_name == 'push' }}
# tags: ${{ steps.meta.outputs.tags }}
# build-args: |
# BASE_IMAGE=${{ matrix.variant }}
# VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
# COMMIT_HASH=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
# BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
# labels: ${{ steps.meta.outputs.labels }}

- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: "ghcr.io/dexidp/dex:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
format: "sarif"
output: "trivy-results.sarif"
if: github.event_name == 'push'
# - name: Run Trivy vulnerability scanner
# uses: aquasecurity/[email protected]
# with:
# image-ref: "ghcr.io/datahow/dex:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
# format: "sarif"
# output: "trivy-results.sarif"
# if: github.event_name == 'push'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: "trivy-results.sarif"
if: github.event_name == 'push'
# - name: Upload Trivy scan results to GitHub Security tab
# uses: github/codeql-action/upload-sarif@v2
# with:
# sarif_file: "trivy-results.sarif"
# if: github.event_name == 'push'
114 changes: 57 additions & 57 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
# # For most projects, this workflow file will not need changing; you simply need
# # to commit it to your repository.
# #
# # You may wish to alter this file to override the set of languages analyzed,
# # or to provide custom queries or build logic.
# #
# # ******** NOTE ********
# # We have attempted to detect the languages in your repository. Please check
# # the `language` matrix defined below to confirm you have the correct set of
# # supported CodeQL languages.
# #
# name: "CodeQL"

on:
push:
branches: [ master, v1 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '28 10 * * 6'
# on:
# push:
# branches: [ master, v1 ]
# pull_request:
# # The branches below must be a subset of the branches above
# branches: [ master ]
# schedule:
# - cron: '28 10 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
# jobs:
# analyze:
# name: Analyze
# runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
# strategy:
# fail-fast: false
# matrix:
# language: [ 'go' ]
# # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# # Learn more:
# # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v3
# steps:
# - name: Checkout repository
# uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# # Initializes the CodeQL tools for scanning.
# - name: Initialize CodeQL
# uses: github/codeql-action/init@v2
# with:
# languages: ${{ matrix.language }}
# # If you wish to specify custom queries, you can do so here or in a config file.
# # By default, queries listed here will override any specified in a config file.
# # Prefix the list here with "+" to use these queries and those in the config file.
# # queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# # If this step fails, then you should remove it and run the build manually (see below)
# - name: Autobuild
# uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# # ℹ️ Command-line programs to run using the OS shell.
# # 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# # and modify them (or add more) to build your code if your project
# # uses a compiled language

#- run: |
# make bootstrap
# make release
# #- run: |
# # make bootstrap
# # make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
# - name: Perform CodeQL Analysis
# uses: github/codeql-action/analyze@v2
20 changes: 10 additions & 10 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Docker

on:
# push:
push:
# branches:
# - master
# tags:
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Calculate Docker image tags
id: tags
env:
DOCKER_IMAGES: "ghcr.io/dexidp/dex dexidp/dex"
DOCKER_IMAGES: "ghcr.io/datahow/dex"
run: |
case $GITHUB_REF in
refs/tags/*) VERSION=${GITHUB_REF#refs/tags/};;
Expand Down Expand Up @@ -64,18 +64,18 @@ jobs:
password: ${{ github.token }}
if: github.event_name == 'push'

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: github.event_name == 'push'
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# if: github.event_name == 'push'

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le
platforms: linux/amd64 #,linux/arm/v7,linux/arm64,linux/ppc64le
# cache-from: type=gha
# cache-to: type=gha,mode=max
push: ${{ github.event_name == 'push' }}
Expand All @@ -98,7 +98,7 @@ jobs:
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
with:
image-ref: "ghcr.io/dexidp/dex:${{ steps.tags.outputs.version }}"
image-ref: "ghcr.io/datahow/dex:${{ steps.tags.outputs.version }}"
format: "template"
template: "@/contrib/sarif.tpl"
output: "trivy-results.sarif"
Expand Down
Loading

0 comments on commit a9b2085

Please sign in to comment.